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.

105 lines
2.9 KiB

  1. // RsaKPGen.h -- RSA Key Pair Generator class declaration
  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_RSAKPGEN_H)
  8. #define SLBCSP_RSAKPGEN_H
  9. #include <windows.h>
  10. #include <utility>
  11. #include <cciCard.h>
  12. #include <cciPriKey.h>
  13. #include <cciPubKey.h>
  14. #include "Blob.h" // for TrimExtraZeroes
  15. #include "RsaKey.h"
  16. class RsaKeyPairGenerator
  17. {
  18. public:
  19. // Types
  20. // C'tors/D'tors
  21. explicit
  22. RsaKeyPairGenerator(cci::CCard const &rhcard,
  23. RsaKey::StrengthType strength =
  24. KeyLimits<RsaKey>::cMaxStrength);
  25. ~RsaKeyPairGenerator();
  26. // Operators
  27. std::pair<cci::CPrivateKey, cci::CPublicKey>
  28. operator()() const;
  29. // Operations
  30. void
  31. Card(cci::CCard const &rhcard);
  32. void
  33. Reset();
  34. void
  35. Strength(RsaKey::StrengthType strength);
  36. void
  37. UseCardGenerator(bool fUseCardGenerator);
  38. // Access
  39. cci::CCard
  40. Card() const;
  41. bool
  42. OnCard() const;
  43. RsaKey::StrengthType
  44. Strength() const;
  45. // Predicates
  46. protected:
  47. // Types
  48. // C'tors/D'tors
  49. // Operators
  50. // Operations
  51. // Access
  52. // Predicates
  53. // Variables
  54. private:
  55. // Types
  56. // C'tors/D'tors
  57. // Operators
  58. // Operations
  59. void
  60. Generate() const;
  61. std::pair<cci::CPrivateKey, cci::CPublicKey>
  62. GenerateInSoftware() const;
  63. std::pair<cci::CPrivateKey, cci::CPublicKey>
  64. GenerateOnCard(cci::KeyType kt) const;
  65. void
  66. ValidateParameters() const;
  67. // Access
  68. // Predicates
  69. // Variables
  70. cci::CCard m_hcard;
  71. std::pair<cci::CPrivateKey, cci::CPublicKey> mutable m_kp;
  72. RsaKey::StrengthType m_strength;
  73. };
  74. #endif // SLBCSP_RSAKPGEN_H