Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.4 KiB

  1. // RsaKey.cpp -- RSA Key implementation
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #include "NoWarning.h"
  8. #include "ForceLib.h"
  9. #include "RsaKey.h"
  10. /////////////////////////// LOCAL/HELPER /////////////////////////////////
  11. RsaKey::OctetLengthType
  12. InOctets(RsaKey::BitLengthType bitlength)
  13. {
  14. return bitlength / 8;
  15. }
  16. RsaKey::BitLengthType
  17. InBits(RsaKey::OctetLengthType octectlength)
  18. {
  19. return octectlength * 8;
  20. }
  21. bool
  22. IsValidRsaKeyStrength(RsaKey::StrengthType strength)
  23. {
  24. return (KeyLimits<RsaKey>::cMinStrength <= strength) &&
  25. (KeyLimits<RsaKey>::cMaxStrength >= strength) &&
  26. (0 == (strength % KeyLimits<RsaKey>::cStrengthIncrement));
  27. }
  28. /////////////////////////// PUBLIC /////////////////////////////////
  29. // Types
  30. // C'tors/D'tors
  31. // Operators
  32. // Operations
  33. // Access
  34. // Predicates
  35. // Static Variables
  36. /////////////////////////// PROTECTED /////////////////////////////////
  37. // C'tors/D'tors
  38. // Operators
  39. // Operations
  40. // Access
  41. // Predicates
  42. // Static Variables
  43. /////////////////////////// PRIVATE /////////////////////////////////
  44. // C'tors/D'tors
  45. // Operators
  46. // Operations
  47. // Access
  48. // Predicates
  49. // Static Variables