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.

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