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.

727 lines
21 KiB

  1. #ifndef __CARDMOD__H__
  2. #define __CARDMOD__H__
  3. #include <windows.h>
  4. #include <wincrypt.h>
  5. #include <winscard.h>
  6. #include "pincache.h"
  7. typedef struct _CARD_DATA CARD_DATA, *PCARD_DATA;
  8. //
  9. // This define can be used as a return value for queries involving
  10. // card data that may be impossible to determine on a given card
  11. // OS, such as the number of available card storage bytes.
  12. //
  13. #define CARD_DATA_VALUE_UNKNOWN ((DWORD) -1)
  14. //
  15. // Well Known Logical Names
  16. //
  17. //
  18. // Logical Directory Names
  19. //
  20. // Second-level logical directories
  21. #define wszCSP_DATA_DIR L"CSP"
  22. #define wszCSP_DATA_DIR_FULL_PATH L"/Microsoft/CSP"
  23. #define wszROOT_CERTS_DIR L"RootCerts"
  24. #define wszROOT_CERTS_DIR_FULL_PATH L"/Microsoft/RootCerts"
  25. #define wszINTERMEDIATE_CERTS_DIR L"IntermediateCerts"
  26. #define wszINTERMEDIATE_CERTS_DIR_FULL_PATH L"/Microsoft/IntermediateCerts"
  27. //
  28. // Logical File Names
  29. //
  30. // When requesting (or otherwise referring to) any logical file, the full path
  31. // must be used, including when referring to well known files. For example,
  32. // to request the wszCONTAINER_MAP_FILE, the provided name will be
  33. // "/Microsoft/CSP/ContainerMapFile".
  34. //
  35. // Well known logical files under Microsoft
  36. #define wszCACHE_FILE L"CacheFile"
  37. #define wszCACHE_FILE_FULL_PATH L"/Microsoft/CacheFile"
  38. #define wszCARD_IDENTIFIER_FILE L"CardIdentifierFile"
  39. #define wszCARD_IDENTIFIER_FILE_FULL_PATH L"/Microsoft/CardIdentifierFile"
  40. #define wszPERSONAL_DATA_FILE L"CardPersonalDataFile"
  41. #define wszPERSONAL_DATA_FILE_FULL_PATH L"/Microsoft/CardPersonalDataFile"
  42. // Well known logical files under CSP
  43. #define wszCONTAINER_MAP_FILE L"ContainerMapFile"
  44. #define wszCONTAINER_MAP_FILE_FULL_PATH L"/Microsoft/CSP/ContainerMapFile"
  45. //
  46. // Well known logical files under User Certs
  47. //
  48. // The following prefixes are appended with the container index of the
  49. // associated key. For example, the certificate associated with the
  50. // Key Exchange key in container index 2 will have the logical name:
  51. // "/Microsoft/CSP/UserCerts/K2"
  52. //
  53. #define wszUSER_SIGNATURE_CERT_PREFIX L"/Microsoft/CSP/UserCerts/S"
  54. #define wszUSER_KEYEXCHANGE_CERT_PREFIX L"/Microsoft/CSP/UserCerts/K"
  55. //
  56. // Logical Card User Names
  57. //
  58. #define wszCARD_USER_EVERYONE L"Everyone"
  59. #define wszCARD_USER_USER L"User"
  60. #define wszCARD_USER_ADMIN L"Administrator"
  61. //
  62. // Converts a card filename string from unicode to ansi
  63. //
  64. DWORD WINAPI I_CardConvertFileNameToAnsi(
  65. IN PCARD_DATA pCardData,
  66. IN LPWSTR wszUnicodeName,
  67. OUT LPSTR *ppszAnsiName);
  68. // Logical File Access Conditions
  69. typedef enum
  70. {
  71. InvalidAc = 0,
  72. // Everyone Read
  73. // User Write
  74. //
  75. // Example: A user certificate file.
  76. EveryoneReadUserWriteAc,
  77. // User Read, Write
  78. //
  79. // Example: A private key file.
  80. UserWriteExecuteAc,
  81. // Everyone Read
  82. // Admin Write
  83. //
  84. // Example: The Card Identifier file.
  85. EveryoneReadAdminWriteAc
  86. } CARD_FILE_ACCESS_CONDITION;
  87. //
  88. // Function: CardAcquireContext
  89. //
  90. // Purpose: Initialize the CARD_DATA structure which will be used by
  91. // the CSP to interact with a specific card.
  92. //
  93. typedef DWORD (WINAPI *PFN_CARD_ACQUIRE_CONTEXT)(
  94. IN OUT PCARD_DATA pCardData,
  95. IN DWORD dwFlags);
  96. DWORD
  97. WINAPI
  98. CardAcquireContext(
  99. IN OUT PCARD_DATA pCardData,
  100. IN DWORD dwFlags);
  101. //
  102. // Function: CardDeleteContext
  103. //
  104. // Purpose: Free resources consumed by the CARD_DATA structure.
  105. //
  106. typedef DWORD (WINAPI *PFN_CARD_DELETE_CONTEXT)(
  107. OUT PCARD_DATA pCardData);
  108. DWORD
  109. WINAPI
  110. CardDeleteContext(
  111. OUT PCARD_DATA pCardData);
  112. //
  113. // Function: CardQueryCapabilities
  114. //
  115. // Purpose: Query the card module for specific functionality
  116. // provided by this card.
  117. //
  118. #define CARD_CAPABILITIES_CURRENT_VERSION 1
  119. typedef struct _CARD_CAPABILITIES
  120. {
  121. DWORD dwVersion;
  122. BOOL fCertificateCompression;
  123. BOOL fKeyGen;
  124. } CARD_CAPABILITIES, *PCARD_CAPABILITIES;
  125. typedef DWORD (WINAPI *PFN_CARD_QUERY_CAPABILITIES)(
  126. IN PCARD_DATA pCardData,
  127. IN OUT PCARD_CAPABILITIES pCardCapabilities);
  128. DWORD
  129. WINAPI
  130. CardQueryCapabilities(
  131. IN PCARD_DATA pCardData,
  132. IN OUT PCARD_CAPABILITIES pCardCapabilities);
  133. //
  134. // Function: CardDeleteContainer
  135. //
  136. // Purpose: Delete the specified key container.
  137. //
  138. typedef DWORD (WINAPI *PFN_CARD_DELETE_CONTAINER)(
  139. IN PCARD_DATA pCardData,
  140. IN BYTE bContainerIndex,
  141. IN DWORD dwReserved);
  142. DWORD
  143. WINAPI
  144. CardDeleteContainer(
  145. IN PCARD_DATA pCardData,
  146. IN BYTE bContainerIndex,
  147. IN DWORD dwReserved);
  148. //
  149. // Function: CardCreateContainer
  150. //
  151. #define CARD_CREATE_CONTAINER_KEY_GEN 1
  152. #define CARD_CREATE_CONTAINER_KEY_IMPORT 2
  153. typedef DWORD (WINAPI *PFN_CARD_CREATE_CONTAINER)(
  154. IN PCARD_DATA pCardData,
  155. IN BYTE bContainerIndex,
  156. IN DWORD dwFlags,
  157. IN DWORD dwKeySpec,
  158. IN DWORD dwKeySize,
  159. IN PBYTE pbKeyData);
  160. DWORD
  161. WINAPI
  162. CardCreateContainer(
  163. IN PCARD_DATA pCardData,
  164. IN BYTE bContainerIndex,
  165. IN DWORD dwFlags,
  166. IN DWORD dwKeySpec,
  167. IN DWORD dwKeySize,
  168. IN PBYTE pbKeyData);
  169. //
  170. // Function: CardGetContainerInfo
  171. //
  172. // Purpose: Query for all public information available about
  173. // the named key container. This includes the Signature
  174. // and Key Exchange type public keys, if they exist.
  175. //
  176. // The pbSigPublicKey and pbKeyExPublicKey buffers contain the
  177. // Signature and Key Exchange public keys, respectively, if they
  178. // exist. The format of these buffers is a Crypto
  179. // API PUBLICKEYBLOB -
  180. //
  181. // BLOBHEADER
  182. // RSAPUBKEY
  183. // modulus
  184. //
  185. #define CONTAINER_INFO_CURRENT_VERSION 1
  186. typedef struct _CONTAINER_INFO
  187. {
  188. DWORD dwVersion;
  189. DWORD dwContainerInfo;
  190. DWORD cbSigPublicKey;
  191. PBYTE pbSigPublicKey;
  192. DWORD cbKeyExPublicKey;
  193. PBYTE pbKeyExPublicKey;
  194. } CONTAINER_INFO, *PCONTAINER_INFO;
  195. typedef DWORD (WINAPI *PFN_CARD_GET_CONTAINER_INFO)(
  196. IN PCARD_DATA pCardData,
  197. IN BYTE bContainerIndex,
  198. IN DWORD dwFlags,
  199. IN OUT PCONTAINER_INFO pContainerInfo);
  200. DWORD
  201. WINAPI
  202. CardGetContainerInfo(
  203. IN PCARD_DATA pCardData,
  204. IN BYTE bContainerIndex,
  205. IN DWORD dwFlags,
  206. IN OUT PCONTAINER_INFO pContainerInfo);
  207. //
  208. // Function: CardSubmitPin
  209. //
  210. typedef DWORD (WINAPI *PFN_CARD_SUBMIT_PIN)(
  211. IN PCARD_DATA pCardData,
  212. IN LPWSTR pwszUserId,
  213. IN PBYTE pbPin,
  214. IN DWORD cbPin,
  215. OUT OPTIONAL PDWORD pcAttemptsRemaining);
  216. DWORD
  217. WINAPI
  218. CardSubmitPin(
  219. IN PCARD_DATA pCardData,
  220. IN LPWSTR pwszUserId,
  221. IN PBYTE pbPin,
  222. IN DWORD cbPin,
  223. OUT OPTIONAL PDWORD pcAttemptsRemaining);
  224. //
  225. // Function: CardGetChallenge
  226. //
  227. typedef DWORD (WINAPI *PFN_CARD_GET_CHALLENGE)(
  228. IN PCARD_DATA pCardData,
  229. OUT PBYTE *ppbChallengeData,
  230. OUT PDWORD pcbChallengeData);
  231. DWORD
  232. WINAPI
  233. CardGetChallenge(
  234. IN PCARD_DATA pCardData,
  235. OUT PBYTE *ppbChallengeData,
  236. OUT PDWORD pcbChallengeData);
  237. //
  238. // Function: CardAuthenticateChallenge
  239. //
  240. typedef DWORD (WINAPI *PFN_CARD_AUTHENTICATE_CHALLENGE)(
  241. IN PCARD_DATA pCardData,
  242. IN PBYTE pbResponseData,
  243. IN DWORD cbResponseData,
  244. OUT OPTIONAL PDWORD pcAttemptsRemaining);
  245. DWORD
  246. WINAPI
  247. CardAuthenticateChallenge(
  248. IN PCARD_DATA pCardData,
  249. IN PBYTE pbResponseData,
  250. IN DWORD cbResponseData,
  251. OUT OPTIONAL PDWORD pcAttemptsRemaining);
  252. //
  253. // Function: CardUnblockPin
  254. //
  255. #define CARD_UNBLOCK_PIN_CHALLENGE_RESPONSE 1
  256. #define CARD_UNBLOCK_PIN_PIN 2
  257. typedef DWORD (WINAPI *PFN_CARD_UNBLOCK_PIN)(
  258. IN PCARD_DATA pCardData,
  259. IN LPWSTR pwszUserId,
  260. IN PBYTE pbAuthenticationData,
  261. IN DWORD cbAuthenticationData,
  262. IN PBYTE pbNewPinData,
  263. IN DWORD cbNewPinData,
  264. IN DWORD cRetryCount,
  265. IN DWORD dwFlags);
  266. DWORD
  267. WINAPI
  268. CardUnblockPin(
  269. IN PCARD_DATA pCardData,
  270. IN LPWSTR pwszUserId,
  271. IN PBYTE pbAuthenticationData,
  272. IN DWORD cbAuthenticationData,
  273. IN PBYTE pbNewPinData,
  274. IN DWORD cbNewPinData,
  275. IN DWORD cRetryCount,
  276. IN DWORD dwFlags);
  277. //
  278. // Function: CardChangeAuthenticator
  279. //
  280. typedef DWORD (WINAPI *PFN_CARD_CHANGE_AUTHENTICATOR)(
  281. IN PCARD_DATA pCardData,
  282. IN LPWSTR pwszUserId,
  283. IN PBYTE pbCurrentAuthenticator,
  284. IN DWORD cbCurrentAuthenticator,
  285. IN PBYTE pbNewAuthenticator,
  286. IN DWORD cbNewAuthenticator,
  287. IN DWORD cRetryCount,
  288. OUT OPTIONAL PDWORD pcAttemptsRemaining);
  289. DWORD
  290. WINAPI
  291. CardChangeAuthenticator(
  292. IN PCARD_DATA pCardData,
  293. IN LPWSTR pwszUserId,
  294. IN PBYTE pbCurrentAuthenticator,
  295. IN DWORD cbCurrentAuthenticator,
  296. IN PBYTE pbNewAuthenticator,
  297. IN DWORD cbNewAuthenticator,
  298. IN DWORD cRetryCount,
  299. OUT OPTIONAL PDWORD pcAttemptsRemaining);
  300. //
  301. // Function: CardDeauthenticate
  302. //
  303. // Purpose: De-authenticate the specified logical user name on the card.
  304. //
  305. // This is an optional API. If implemented, this API is used instead
  306. // of SCARD_RESET_CARD by the Base CSP. An example scenario is leaving
  307. // a transaction in which the card has been authenticated (a Pin has been
  308. // successfully presented).
  309. //
  310. // The pwszUserId parameter will point to a valid well-known User Name (see
  311. // above).
  312. //
  313. // The dwFlags parameter is currently unused and will always be zero.
  314. //
  315. // Card modules that choose to not implement this API must set the CARD_DATA
  316. // pfnCardDeauthenticate pointer to NULL.
  317. //
  318. typedef DWORD (WINAPI *PFN_CARD_DEAUTHENTICATE)(
  319. IN PCARD_DATA pCardData,
  320. IN LPWSTR pwszUserId,
  321. IN DWORD dwFlags);
  322. DWORD
  323. WINAPI
  324. CardDeauthenticate(
  325. IN PCARD_DATA pCardData,
  326. IN LPWSTR pwszUserId,
  327. IN DWORD dwFlags);
  328. //
  329. // Function: CardCreateFile
  330. //
  331. typedef DWORD (WINAPI *PFN_CARD_CREATE_FILE)(
  332. IN PCARD_DATA pCardData,
  333. IN LPWSTR pwszFileName,
  334. IN CARD_FILE_ACCESS_CONDITION AccessCondition);
  335. DWORD
  336. WINAPI
  337. CardCreateFile(
  338. IN PCARD_DATA pCardData,
  339. IN LPWSTR pwszFileName,
  340. IN CARD_FILE_ACCESS_CONDITION AccessCondition);
  341. //
  342. // Function: CardReadFile
  343. //
  344. // Purpose: Read the specified file from the card.
  345. //
  346. // The pbData parameter should be allocated
  347. // by the card module and freed by the CSP. The card module
  348. // must set the cbData parameter to the size of the returned buffer.
  349. //
  350. typedef DWORD (WINAPI *PFN_CARD_READ_FILE)(
  351. IN PCARD_DATA pCardData,
  352. IN LPWSTR pwszFileName,
  353. IN DWORD dwFlags,
  354. OUT PBYTE *ppbData,
  355. OUT PDWORD pcbData);
  356. DWORD
  357. WINAPI
  358. CardReadFile(
  359. IN PCARD_DATA pCardData,
  360. IN LPWSTR pwszFileName,
  361. IN DWORD dwFlags,
  362. OUT PBYTE *ppbData,
  363. OUT PDWORD pcbData);
  364. //
  365. // Function: CardWriteFile
  366. //
  367. typedef DWORD (WINAPI *PFN_CARD_WRITE_FILE)(
  368. IN PCARD_DATA pCardData,
  369. IN LPWSTR pwszFileName,
  370. IN DWORD dwFlags,
  371. IN PBYTE pbData,
  372. IN DWORD cbData);
  373. DWORD
  374. WINAPI
  375. CardWriteFile(
  376. IN PCARD_DATA pCardData,
  377. IN LPWSTR pwszFileName,
  378. IN DWORD dwFlags,
  379. IN PBYTE pbData,
  380. IN DWORD cbData);
  381. //
  382. // Function: CardDeleteFile
  383. //
  384. typedef DWORD (WINAPI *PFN_CARD_DELETE_FILE)(
  385. IN PCARD_DATA pCardData,
  386. IN DWORD dwReserved,
  387. IN LPWSTR pwszFileName);
  388. DWORD
  389. WINAPI
  390. CardDeleteFile(
  391. IN PCARD_DATA pCardData,
  392. IN DWORD dwReserved,
  393. IN LPWSTR pwszFileName);
  394. //
  395. // Function: CardEnumFiles
  396. //
  397. // Purpose: Return a multi-string list of the general files
  398. // present on this card. The multi-string is allocated
  399. // by the card module and must be freed by the CSP.
  400. //
  401. // The caller must provide a logical file directory name in the
  402. // pmwszFileNames parameter (see Logical Directory Names, above).
  403. // The logical directory name indicates which group of files will be
  404. // enumerated.
  405. //
  406. // The logical directory name is expected to be a static string, so the
  407. // the card module will not free it. The card module
  408. // will allocate a new buffer in *pmwszFileNames to store the multi-string
  409. // list of enumerated files using pCardData->pfnCspAlloc.
  410. //
  411. // If the function fails for any reason, *pmwszFileNames is set to NULL.
  412. //
  413. typedef DWORD (WINAPI *PFN_CARD_ENUM_FILES)(
  414. IN PCARD_DATA pCardData,
  415. IN DWORD dwFlags,
  416. IN OUT LPWSTR *pmwszFileNames);
  417. DWORD
  418. WINAPI
  419. CardEnumFiles(
  420. IN PCARD_DATA pCardData,
  421. IN DWORD dwFlags,
  422. IN OUT LPWSTR *pmwszFileNames);
  423. //
  424. // Function: CardGetFileInfo
  425. //
  426. #define CARD_FILE_INFO_CURRENT_VERSION 1
  427. typedef struct _CARD_FILE_INFO
  428. {
  429. DWORD dwVersion;
  430. DWORD cbFileSize;
  431. CARD_FILE_ACCESS_CONDITION AccessCondition;
  432. } CARD_FILE_INFO, *PCARD_FILE_INFO;
  433. typedef DWORD (WINAPI *PFN_CARD_GET_FILE_INFO)(
  434. IN PCARD_DATA pCardData,
  435. IN LPWSTR pwszFileName,
  436. OUT PCARD_FILE_INFO pCardFileInfo);
  437. DWORD
  438. WINAPI
  439. CardGetFileInfo(
  440. IN PCARD_DATA pCardData,
  441. IN LPWSTR pwszFileName,
  442. OUT PCARD_FILE_INFO pCardFileInfo);
  443. //
  444. // Function: CardQueryFreeSpace
  445. //
  446. #define CARD_FREE_SPACE_INFO_CURRENT_VERSION 1
  447. typedef struct _CARD_FREE_SPACE_INFO
  448. {
  449. DWORD dwVersion;
  450. DWORD dwBytesAvailable;
  451. DWORD dwKeyContainersAvailable;
  452. DWORD dwMaxKeyContainers;
  453. } CARD_FREE_SPACE_INFO, *PCARD_FREE_SPACE_INFO;
  454. typedef DWORD (WINAPI *PFN_CARD_QUERY_FREE_SPACE)(
  455. IN PCARD_DATA pCardData,
  456. IN DWORD dwFlags,
  457. OUT PCARD_FREE_SPACE_INFO pCardFreeSpaceInfo);
  458. DWORD
  459. WINAPI
  460. CardQueryFreeSpace(
  461. IN PCARD_DATA pCardData,
  462. IN DWORD dwFlags,
  463. OUT PCARD_FREE_SPACE_INFO pCardFreeSpaceInfo);
  464. //
  465. // Function: CardPrivateKeyDecrypt
  466. //
  467. // Purpose: Perform a private key decryption on the supplied data. The
  468. // card module should assume that pbData is the length of the
  469. // key modulus.
  470. //
  471. #define CARD_PRIVATE_KEY_DECRYPT_INFO_CURRENT_VERSION 1
  472. typedef struct _CARD_PRIVATE_KEY_DECRYPT_INFO
  473. {
  474. DWORD dwVersion; // IN
  475. BYTE bContainerIndex; // IN
  476. // For RSA operations, this should be AT_SIGNATURE or AT_KEYEXCHANGE.
  477. DWORD dwKeySpec; // IN
  478. // This is the buffer and length that the caller expects to be decrypted.
  479. // For RSA operations, cbData is redundant since the length of the buffer
  480. // should always be equal to the length of the key modulus.
  481. PBYTE pbData; // IN | OUT
  482. DWORD cbData; // IN | OUT
  483. } CARD_PRIVATE_KEY_DECRYPT_INFO, *PCARD_PRIVATE_KEY_DECRYPT_INFO;
  484. typedef DWORD (WINAPI *PFN_CARD_PRIVATE_KEY_DECRYPT)(
  485. IN PCARD_DATA pCardData,
  486. IN OUT PCARD_PRIVATE_KEY_DECRYPT_INFO pInfo);
  487. DWORD
  488. WINAPI
  489. CardPrivateKeyDecrypt(
  490. IN PCARD_DATA pCardData,
  491. IN OUT PCARD_PRIVATE_KEY_DECRYPT_INFO pInfo);
  492. //
  493. // Function: CardQueryKeySizes
  494. //
  495. #define CARD_KEY_SIZES_CURRENT_VERSION 1
  496. typedef struct _CARD_KEY_SIZES
  497. {
  498. DWORD dwVersion;
  499. DWORD dwMinimumBitlen;
  500. DWORD dwDefaultBitlen;
  501. DWORD dwMaximumBitlen;
  502. DWORD dwIncrementalBitlen;
  503. } CARD_KEY_SIZES, *PCARD_KEY_SIZES;
  504. typedef DWORD (WINAPI *PFN_CARD_QUERY_KEY_SIZES)(
  505. IN PCARD_DATA pCardData,
  506. IN DWORD dwKeySpec,
  507. IN DWORD dwReserved,
  508. OUT PCARD_KEY_SIZES pKeySizes);
  509. DWORD
  510. WINAPI
  511. CardQueryKeySizes(
  512. IN PCARD_DATA pCardData,
  513. IN DWORD dwKeySpec,
  514. IN DWORD dwReserved,
  515. OUT PCARD_KEY_SIZES pKeySizes);
  516. //
  517. // Memory Management Routines
  518. //
  519. // These routines are supplied to the card module
  520. // by the calling CSP.
  521. //
  522. //
  523. // Function: PFN_CSP_ALLOC
  524. //
  525. typedef LPVOID (WINAPI *PFN_CSP_ALLOC)(
  526. IN SIZE_T Size);
  527. //
  528. // Function: PFN_CSP_REALLOC
  529. //
  530. typedef LPVOID (WINAPI *PFN_CSP_REALLOC)(
  531. IN LPVOID Address,
  532. IN SIZE_T Size);
  533. //
  534. // Function: PFN_CSP_FREE
  535. //
  536. // Note: Data allocated for the CSP by the card module must
  537. // be freed by the CSP.
  538. //
  539. typedef void (WINAPI *PFN_CSP_FREE)(
  540. IN LPVOID Address);
  541. //
  542. // Function: PFN_CSP_CACHE_ADD_FILE
  543. //
  544. // A copy of the pbData parameter is added to the cache.
  545. //
  546. typedef DWORD (WINAPI *PFN_CSP_CACHE_ADD_FILE)(
  547. IN PVOID pvCacheContext,
  548. IN LPWSTR wszTag,
  549. IN DWORD dwFlags,
  550. IN PBYTE pbData,
  551. IN DWORD cbData);
  552. //
  553. // Function: PFN_CSP_CACHE_LOOKUP_FILE
  554. //
  555. // If the cache lookup is successful,
  556. // the caller must free the *ppbData pointer with pfnCspFree.
  557. //
  558. typedef DWORD (WINAPI *PFN_CSP_CACHE_LOOKUP_FILE)(
  559. IN PVOID pvCacheContext,
  560. IN LPWSTR wszTag,
  561. IN DWORD dwFlags,
  562. IN PBYTE *ppbData,
  563. IN PDWORD pcbData);
  564. //
  565. // Function: PFN_CSP_CACHE_DELETE_FILE
  566. //
  567. // Deletes the specified item from the cache.
  568. //
  569. typedef DWORD (WINAPI *PFN_CSP_CACHE_DELETE_FILE)(
  570. IN PVOID pvCacheContext,
  571. IN LPWSTR wszTag,
  572. IN DWORD dwFlags);
  573. //
  574. // Type: CARD_DATA
  575. //
  576. #define CARD_DATA_CURRENT_VERSION 1
  577. typedef struct _CARD_DATA
  578. {
  579. // These members must be initialized by the CSP before
  580. // calling CardAcquireContext.
  581. DWORD dwVersion;
  582. PBYTE pbAtr;
  583. DWORD cbAtr;
  584. LPWSTR pwszCardName;
  585. PFN_CSP_ALLOC pfnCspAlloc;
  586. PFN_CSP_REALLOC pfnCspReAlloc;
  587. PFN_CSP_FREE pfnCspFree;
  588. PFN_CSP_CACHE_ADD_FILE pfnCspCacheAddFile;
  589. PFN_CSP_CACHE_LOOKUP_FILE pfnCspCacheLookupFile;
  590. PFN_CSP_CACHE_DELETE_FILE pfnCspCacheDeleteFile;
  591. PVOID pvCacheContext;
  592. SCARDCONTEXT hSCardCtx;
  593. SCARDHANDLE hScard;
  594. // These members are initialized by the card module
  595. PFN_CARD_DELETE_CONTEXT pfnCardDeleteContext;
  596. PFN_CARD_QUERY_CAPABILITIES pfnCardQueryCapabilities;
  597. PFN_CARD_DELETE_CONTAINER pfnCardDeleteContainer;
  598. PFN_CARD_CREATE_CONTAINER pfnCardCreateContainer;
  599. PFN_CARD_GET_CONTAINER_INFO pfnCardGetContainerInfo;
  600. PFN_CARD_SUBMIT_PIN pfnCardSubmitPin;
  601. PFN_CARD_GET_CHALLENGE pfnCardGetChallenge;
  602. PFN_CARD_AUTHENTICATE_CHALLENGE pfnCardAuthenticateChallenge;
  603. PFN_CARD_UNBLOCK_PIN pfnCardUnblockPin;
  604. PFN_CARD_CHANGE_AUTHENTICATOR pfnCardChangeAuthenticator;
  605. PFN_CARD_DEAUTHENTICATE pfnCardDeauthenticate;
  606. PFN_CARD_CREATE_FILE pfnCardCreateFile;
  607. PFN_CARD_READ_FILE pfnCardReadFile;
  608. PFN_CARD_WRITE_FILE pfnCardWriteFile;
  609. PFN_CARD_DELETE_FILE pfnCardDeleteFile;
  610. PFN_CARD_ENUM_FILES pfnCardEnumFiles;
  611. PFN_CARD_GET_FILE_INFO pfnCardGetFileInfo;
  612. PFN_CARD_QUERY_FREE_SPACE pfnCardQueryFreeSpace;
  613. PFN_CARD_PRIVATE_KEY_DECRYPT pfnCardPrivateKeyDecrypt;
  614. PFN_CARD_QUERY_KEY_SIZES pfnCardQueryKeySizes;
  615. PVOID pvVendorSpecific;
  616. } CARD_DATA, *PCARD_DATA;
  617. #endif