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.

217 lines
5.8 KiB

  1. // cciV2Card.h: interface for the CV2Card 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_V2CARD_H)
  12. #define CCI_V2CARD_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 "CardInfo.h"
  21. #include "SymbolTable.h"
  22. #include "ObjectInfoFile.h"
  23. #include "cciCert.h"
  24. #include "cciPubKey.h"
  25. #include "cciPriKey.h"
  26. #include "cciDataObj.h"
  27. #include "Marker.h"
  28. namespace cci
  29. {
  30. class CV2Container;
  31. class CV2Card // concrete class
  32. : public CAbstractCard
  33. {
  34. friend CAbstractCard *
  35. CAbstractCard::Make(std::string const &rstrReaderName);
  36. public:
  37. // Types
  38. // C'tors/D'tors
  39. virtual
  40. ~CV2Card() throw();
  41. // Operators
  42. // Operations
  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. cci::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. virtual void
  60. VerifyKey(std::string const &rstrKey,
  61. BYTE bKeyNum);
  62. // Access
  63. size_t
  64. AvailableStringSpace(ObjectAccess oa) const;
  65. CCardInfo &
  66. CardInfo() const;
  67. virtual CContainer
  68. DefaultContainer() const;
  69. virtual std::vector<CContainer>
  70. EnumContainers() const;
  71. virtual std::vector<CCertificate>
  72. EnumCertificates(ObjectAccess access) const;
  73. virtual std::vector<CPublicKey>
  74. EnumPublicKeys(ObjectAccess access) const;
  75. virtual std::vector<CPrivateKey>
  76. EnumPrivateKeys(ObjectAccess access) const;
  77. virtual std::vector<CDataObject>
  78. EnumDataObjects(ObjectAccess access) const;
  79. virtual std::string
  80. Label() const;
  81. BYTE
  82. MaxKeys(KeyType kt) const;
  83. size_t
  84. MaxStringSpace(ObjectAccess oa) const;
  85. CObjectInfoFile &
  86. ObjectInfoFile(ObjectAccess oa) const;
  87. virtual std::string
  88. PrivateKeyPath(KeyType kt) const;
  89. virtual std::string const &
  90. RootPath() const;
  91. virtual bool
  92. SupportedKeyFunction(KeyType kt,
  93. CardOperation oper) const;
  94. // Predicates
  95. virtual bool
  96. IsCAPIEnabled() const;
  97. virtual bool
  98. IsPKCS11Enabled() const;
  99. virtual bool
  100. IsEntrustEnabled() const;
  101. virtual bool
  102. IsProtectedMode() const;
  103. virtual bool
  104. IsKeyGenEnabled() const;
  105. virtual BYTE
  106. MajorVersion() const;
  107. protected:
  108. // Types
  109. // C'tors/D'tors
  110. CV2Card(std::string const &rstrReaderName,
  111. std::auto_ptr<iop::CIOP> &rapiop,
  112. std::auto_ptr<iop::CSmartCard> &rapSmartCard);
  113. // Note/TO DO: CardInfo is likely to be specific to the
  114. // CV2Card's format version. Therefore, the extent that a
  115. // subclass can be defined for CV2Card is limited by the
  116. // ability of that subclass to utilize CV2Card's CardInfo. A
  117. // concept to revisit.
  118. // Operators
  119. // Operations
  120. void
  121. DoSetup();
  122. virtual CAbstractCertificate *
  123. MakeCertificate(ObjectAccess oa) const;
  124. virtual CAbstractContainer *
  125. MakeContainer() const;
  126. virtual CAbstractDataObject *
  127. MakeDataObject(ObjectAccess oa) const;
  128. virtual CAbstractKeyPair *
  129. MakeKeyPair(CContainer const &rhcont,
  130. KeySpec ks) const;
  131. virtual CAbstractPrivateKey *
  132. MakePrivateKey(ObjectAccess oa) const;
  133. virtual CAbstractPublicKey *
  134. MakePublicKey(ObjectAccess oa) const;
  135. // Access
  136. // Predicates
  137. // Variables
  138. private:
  139. // Types
  140. typedef CAbstractCard SuperClass;
  141. // C'tors/D'tors
  142. // Operators
  143. // Operations
  144. static std::auto_ptr<CAbstractCard>
  145. DoMake(std::string const &rstrReaderName,
  146. std::auto_ptr<iop::CIOP> &rapiop,
  147. std::auto_ptr<iop::CSmartCard> &rapSmartCard);
  148. // Access
  149. // Predicates
  150. // Variables
  151. std::auto_ptr<CCardInfo> m_apCardInfo;
  152. std::auto_ptr<CObjectInfoFile> mutable m_apPublicObjectInfoFile;
  153. std::auto_ptr<CObjectInfoFile> mutable m_apPrivateObjectInfoFile;
  154. ArchivedSymbol mutable m_asLabel;
  155. };
  156. }
  157. #endif