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.

214 lines
5.5 KiB

  1. // cciV1Card.h: interface for the CV1Card class.
  2. //
  3. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  4. // 1999. This computer program includes Confidential, Proprietary
  5. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  6. // use, disclosure, and/or reproduction is prohibited unless authorized
  7. // in writing. All Rights Reserved.
  8. //////////////////////////////////////////////////////////////////////
  9. // Note: This header file should only be included by the CCI. The
  10. // client gets the declarations via cciCard.h
  11. #if !defined(CCI_V1CARD_H)
  12. #define CCI_V1CARD_H
  13. #include <memory> // for auto_ptr
  14. #include <string>
  15. #include <vector>
  16. #include <iop.h>
  17. #include <slbRCObj.h>
  18. #include "ACard.h"
  19. #include "cciCont.h"
  20. #include "cciCert.h"
  21. #include "cciKeyPair.h"
  22. #include "cciPubKey.h"
  23. #include "cciPriKey.h"
  24. #include "cciDataObj.h"
  25. #include "Marker.h"
  26. #include "ArchivedValue.h"
  27. namespace cci
  28. {
  29. class CV1Card // concrete class
  30. : public CAbstractCard
  31. {
  32. friend CAbstractCard *
  33. CAbstractCard::Make(std::string const &rstrReaderName);
  34. public:
  35. // Types
  36. // C'tors/D'tors
  37. virtual
  38. ~CV1Card() throw();
  39. // Operators
  40. // Operations
  41. void
  42. CardId(std::string const &rsNewCardId) const;
  43. virtual void
  44. ChangePIN(std::string const &rstrOldPIN,
  45. std::string const &rstrNewPIN);
  46. virtual void
  47. DefaultContainer(CContainer const &rcont);
  48. virtual std::pair<std::string, // interpreted as the public modulus
  49. CPrivateKey>
  50. GenerateKeyPair(KeyType kt,
  51. std::string const &rsExponent,
  52. ObjectAccess oaPrivateKey = oaPrivateAccess);
  53. virtual void
  54. InitCard();
  55. virtual void
  56. InvalidateCache();
  57. virtual void
  58. Label(std::string const &rstrLabel);
  59. DWORD
  60. OpenFile(char const *szPath) const;
  61. virtual void
  62. VerifyKey(std::string const &rstrKey,
  63. BYTE bKeyNum);
  64. // Access
  65. size_t
  66. AvailableStringSpace(ObjectAccess oa) const;
  67. std::string
  68. CardId() const;
  69. virtual CContainer
  70. DefaultContainer() const;
  71. virtual std::vector<CContainer>
  72. EnumContainers() const;
  73. virtual std::vector<CCertificate>
  74. EnumCertificates(ObjectAccess access) const;
  75. virtual std::vector<CPublicKey>
  76. EnumPublicKeys(ObjectAccess access) const;
  77. virtual std::vector<CPrivateKey>
  78. EnumPrivateKeys(ObjectAccess access) const;
  79. virtual std::vector<CDataObject>
  80. EnumDataObjects(ObjectAccess access) const;
  81. virtual std::string
  82. Label() const;
  83. BYTE
  84. MaxKeys(KeyType kt) const;
  85. size_t
  86. MaxStringSpace(ObjectAccess oa) const;
  87. virtual bool
  88. SupportedKeyFunction(KeyType kt,
  89. CardOperation oper) const;
  90. // Predicates
  91. virtual bool
  92. IsCAPIEnabled() const;
  93. virtual bool
  94. IsPKCS11Enabled() const;
  95. virtual bool
  96. IsEntrustEnabled() const;
  97. virtual bool
  98. IsProtectedMode() const;
  99. virtual bool
  100. IsKeyGenEnabled() const;
  101. virtual BYTE
  102. MajorVersion() const;
  103. protected:
  104. // Types
  105. // C'tors/D'tors
  106. CV1Card(std::string const &rstrReaderName,
  107. std::auto_ptr<iop::CIOP> &rapiop,
  108. std::auto_ptr<iop::CSmartCard> &rapSmartCard);
  109. // Operators
  110. // Operations
  111. void
  112. DoSetup();
  113. virtual CAbstractCertificate *
  114. MakeCertificate(ObjectAccess oa) const;
  115. virtual CAbstractContainer *
  116. MakeContainer() const;
  117. virtual CAbstractDataObject *
  118. MakeDataObject(ObjectAccess oa) const;
  119. virtual CAbstractKeyPair *
  120. MakeKeyPair(CContainer const &rhcont,
  121. KeySpec ks) const;
  122. virtual CAbstractPrivateKey *
  123. MakePrivateKey(ObjectAccess oa) const;
  124. virtual CAbstractPublicKey *
  125. MakePublicKey(ObjectAccess oa) const;
  126. // Access
  127. // Predicates
  128. // Variables
  129. private:
  130. // Types
  131. typedef CAbstractCard SuperClass;
  132. // C'tors/D'tors
  133. // Operators
  134. // Operations
  135. static std::auto_ptr<CAbstractCard>
  136. DoMake(std::string const &rstrReaderName,
  137. std::auto_ptr<iop::CIOP> &rapiop,
  138. std::auto_ptr<iop::CSmartCard> &rapSmartCard);
  139. std::string
  140. ReadCardId() const;
  141. void
  142. RefreshCardId() const;
  143. // Access
  144. // Predicates
  145. // Variables
  146. std::string mutable m_sCardId;
  147. CArchivedValue<CContainer> mutable m_avhDefaultCntr;
  148. CArchivedValue<CKeyPair> mutable m_avhExchangeKeyPair;
  149. CArchivedValue<CKeyPair> mutable m_avhSignatureKeyPair;
  150. };
  151. } // namespace cci
  152. #endif // CCI_CV1CARD_H