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.

113 lines
3.3 KiB

  1. // CardInfo.h: interface for the CCardInfo 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. #if !defined(AFX_CARDINFO_H__F4AD08D3_143B_11D3_A587_00104BD32DA8__INCLUDED_)
  10. #define AFX_CARDINFO_H__F4AD08D3_143B_11D3_A587_00104BD32DA8__INCLUDED_
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif // _MSC_VER > 1000
  14. #include <scuArrayP.h>
  15. #include <iop.h>
  16. #include "slbCci.h"
  17. namespace cci
  18. {
  19. class CCard;
  20. class CCardInfo
  21. {
  22. public:
  23. CCardInfo(iop::CSmartCard &rCard);
  24. virtual ~CCardInfo();
  25. void UpdateCache();
  26. void Reset();
  27. Date PersonalizationDate() { return m_PersoDate; };
  28. void PersonalizationDate(Date const &rdtPerso);
  29. Format FormatVersion() { return m_Format; };
  30. unsigned short LabelSize() { return m_sLabelSize; };
  31. BYTE UsagePolicy() { return m_bUsagePolicy; };
  32. BYTE NumRSA512Keys() { return m_bNum512Pri; };
  33. BYTE NumRSA768Keys() { return m_bNum768Pri; };
  34. BYTE NumRSA1024Keys() { return m_bNum1024Pri; };
  35. BYTE AllocatePrivateKey(BYTE bKeyType);
  36. void FreePrivateKey(BYTE bKeyType, BYTE bKeyNum);
  37. void Label(std::string const &rLabel);
  38. std::string Label();
  39. private:
  40. unsigned short UsageBlockSize() { return (m_sRSA512MaskSize + m_sRSA768MaskSize + m_sRSA1024MaskSize);};
  41. iop::CSmartCard &m_rSmartCard;
  42. Date m_PersoDate;
  43. Format m_Format;
  44. unsigned short m_sLabelSize;
  45. BYTE m_bUsagePolicy;
  46. BYTE m_bNum512Pri;
  47. BYTE m_bNum768Pri;
  48. BYTE m_bNum1024Pri;
  49. scu::AutoArrayPtr<BYTE> m_aabRSA512Keys;
  50. scu::AutoArrayPtr<BYTE> m_aabRSA768Keys;
  51. scu::AutoArrayPtr<BYTE> m_aabRSA1024Keys;
  52. unsigned short m_sRSA512MaskOffset;
  53. unsigned short m_sRSA512MaskSize;
  54. unsigned short m_sRSA768MaskOffset;
  55. unsigned short m_sRSA768MaskSize;
  56. unsigned short m_sRSA1024MaskOffset;
  57. unsigned short m_sRSA1024MaskSize;
  58. };
  59. const unsigned short CardDateLoc = 0;
  60. const unsigned short CardVersionMajorLoc = 3;
  61. const unsigned short CardVersionMinorLoc = 4;
  62. const unsigned short CardUsagePolicyLoc = 5;
  63. const unsigned short CardLabelSizeLoc = 8;
  64. const unsigned short CardNumRSA512PublLoc = 20;
  65. const unsigned short CardNumRSA512PrivLoc = 21;
  66. const unsigned short CardNumRSA768PublLoc = 22;
  67. const unsigned short CardNumRSA768PrivLoc = 23;
  68. const unsigned short CardNumRSA1024PublLoc = 24;
  69. const unsigned short CardNumRSA1024PrivLoc = 25;
  70. const unsigned short CardMasterBlkSize = 42;
  71. const BYTE CardCryptoAPIEnabledFlag = 0;
  72. const BYTE CardPKCS11EnabledFlag = 1;
  73. const BYTE CardEntrustEnabledFlag = 2;
  74. const BYTE CardProtectedWriteFlag = 3;
  75. const BYTE CardKeyGenSupportedFlag = 7;
  76. const BYTE CardKeyTypeNone = 0;
  77. const BYTE CardKeyTypeRSA512 = 1;
  78. const BYTE CardKeyTypeRSA768 = 2;
  79. const BYTE CardKeyTypeRSA1024 = 3;
  80. const char CardInfoFilePath[] = "/3f00/3f11/0020";
  81. }
  82. #endif // !defined(AFX_CARDINFO_H__F4AD08D3_143B_11D3_A587_00104BD32DA8__INCLUDED_)