Leaked source code of windows server 2003
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.

219 lines
5.8 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 "ArchivedValue.h"
  26. namespace cci
  27. {
  28. class CV1Card // concrete class
  29. : public CAbstractCard
  30. {
  31. friend CAbstractCard *
  32. CAbstractCard::Make(std::string const &rstrReaderName);
  33. public:
  34. // Types
  35. // C'tors/D'tors
  36. virtual
  37. ~CV1Card() throw();
  38. // Operators
  39. // Operations
  40. void
  41. CardId(std::string const &rsNewCardId) const;
  42. virtual void
  43. ChangePIN(scu::SecureArray<BYTE> const &rstrOldPIN,
  44. scu::SecureArray<BYTE> const &rstrNewPIN);
  45. virtual void
  46. DefaultContainer(CContainer const &rcont);
  47. virtual std::pair<std::string, // interpreted as the public modulus
  48. CPrivateKey>
  49. GenerateKeyPair(KeyType kt,
  50. std::string const &rsExponent,
  51. ObjectAccess oaPrivateKey = oaPrivateAccess);
  52. virtual void
  53. InitCard();
  54. virtual void
  55. InvalidateCache();
  56. virtual void
  57. Label(std::string const &rstrLabel);
  58. DWORD
  59. OpenFile(char const *szPath) const;
  60. virtual void
  61. VerifyKey(std::string const &rstrKey,
  62. BYTE bKeyNum);
  63. // Access
  64. size_t
  65. AvailableStringSpace(ObjectAccess oa) const;
  66. std::string
  67. CardId() const;
  68. virtual CContainer
  69. DefaultContainer() const;
  70. virtual std::vector<CContainer>
  71. EnumContainers() const;
  72. virtual std::vector<CCertificate>
  73. EnumCertificates(ObjectAccess access) const;
  74. virtual std::vector<CPublicKey>
  75. EnumPublicKeys(ObjectAccess access) const;
  76. virtual std::vector<CPrivateKey>
  77. EnumPrivateKeys(ObjectAccess access) const;
  78. virtual std::vector<CDataObject>
  79. EnumDataObjects(ObjectAccess access) const;
  80. virtual std::string
  81. Label() const;
  82. BYTE
  83. MaxKeys(KeyType kt) const;
  84. size_t
  85. MaxStringSpace(ObjectAccess oa) const;
  86. virtual bool
  87. SupportedKeyFunction(KeyType kt,
  88. CardOperation oper) const;
  89. virtual scu::Marker<unsigned int>
  90. MarkerOnCard() const;
  91. // Predicates
  92. virtual bool
  93. IsCAPIEnabled() const;
  94. virtual bool
  95. IsPKCS11Enabled() const;
  96. virtual bool
  97. IsEntrustEnabled() const;
  98. virtual bool
  99. IsProtectedMode() const;
  100. virtual bool
  101. IsKeyGenEnabled() const;
  102. virtual BYTE
  103. MajorVersion() const;
  104. virtual bool
  105. IsMarkerOnCard() const;
  106. protected:
  107. // Types
  108. // C'tors/D'tors
  109. CV1Card(std::string const &rstrReaderName,
  110. std::auto_ptr<iop::CIOP> &rapiop,
  111. std::auto_ptr<iop::CSmartCard> &rapSmartCard);
  112. // Operators
  113. // Operations
  114. void
  115. DoSetup();
  116. virtual CAbstractCertificate *
  117. MakeCertificate(ObjectAccess oa) const;
  118. virtual CAbstractContainer *
  119. MakeContainer() const;
  120. virtual CAbstractDataObject *
  121. MakeDataObject(ObjectAccess oa) const;
  122. virtual CAbstractKeyPair *
  123. MakeKeyPair(CContainer const &rhcont,
  124. KeySpec ks) const;
  125. virtual CAbstractPrivateKey *
  126. MakePrivateKey(ObjectAccess oa) const;
  127. virtual CAbstractPublicKey *
  128. MakePublicKey(ObjectAccess oa) const;
  129. // Access
  130. // Predicates
  131. // Variables
  132. private:
  133. // Types
  134. typedef CAbstractCard SuperClass;
  135. // C'tors/D'tors
  136. // Operators
  137. // Operations
  138. static std::auto_ptr<CAbstractCard>
  139. DoMake(std::string const &rstrReaderName,
  140. std::auto_ptr<iop::CIOP> &rapiop,
  141. std::auto_ptr<iop::CSmartCard> &rapSmartCard);
  142. std::string
  143. ReadCardId() const;
  144. void
  145. RefreshCardId() const;
  146. // Access
  147. // Predicates
  148. // Variables
  149. std::string mutable m_sCardId;
  150. CArchivedValue<CContainer> mutable m_avhDefaultCntr;
  151. CArchivedValue<CKeyPair> mutable m_avhExchangeKeyPair;
  152. CArchivedValue<CKeyPair> mutable m_avhSignatureKeyPair;
  153. };
  154. } // namespace cci
  155. #endif // CCI_CV1CARD_H