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.

62 lines
1.4 KiB

  1. // RsaKey.h -- RSA Key class header
  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. #if !defined(SLBCSP_RSAKEY_H)
  8. #define SLBCSP_RSAKEY_H
  9. #include "KeyLimits.h"
  10. struct RsaKey
  11. {
  12. public:
  13. // limited by Microsoft CryptAPI, see CryptGenKey.
  14. typedef unsigned __int16 BitLengthType; // key length (strength)
  15. typedef BitLengthType StrengthType;
  16. typedef unsigned __int16 OctetLengthType; // modulus length in octets
  17. typedef unsigned __int16 ModulusLengthType;
  18. enum Type
  19. {
  20. ktPrivate,
  21. ktPublic
  22. };
  23. };
  24. RsaKey::OctetLengthType
  25. InOctets(RsaKey::BitLengthType bitlength);
  26. RsaKey::BitLengthType
  27. InBits(RsaKey::OctetLengthType octetlength);
  28. bool
  29. IsValidRsaKeyStrength(RsaKey::StrengthType strength);
  30. template<>
  31. class KeyLimits<RsaKey>
  32. {
  33. public:
  34. // The following are defined as enums since VC++ 6.0 does
  35. // not support initialization of constant declarations.
  36. enum
  37. {
  38. cMinStrength = 512, // defined by card
  39. cMaxStrength = 1024, // <-- DO NOT CHANGE -- US Export restricted
  40. cStrengthIncrement = 256,
  41. };
  42. };
  43. #endif // SLBCSP_RSAKEY_H