1 |
vletoux |
1 |
/* OpenPGP Smart Card Mini Driver |
2 |
|
|
Copyright (C) 2009 Vincent Le Toux |
3 |
|
|
|
4 |
|
|
This library is Free software; you can redistribute it and/or |
5 |
|
|
modify it under the terms of the GNU Lesser General Public |
6 |
|
|
License version 2.1 as published by the Free Software Foundation. |
7 |
|
|
|
8 |
|
|
This library is distributed in the hope that it will be useful, |
9 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 |
|
|
Lesser General Public License for more details. |
12 |
|
|
|
13 |
|
|
You should have received a copy of the GNU Lesser General Public |
14 |
|
|
License along with this library; if not, write to the Free Software |
15 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
16 |
|
|
*/ |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
typedef struct _OPENPGP_AID |
20 |
|
|
{ |
21 |
|
|
BYTE AidRid[5]; |
22 |
|
|
BYTE AidApplication[1]; |
23 |
|
|
BYTE AidVersion[2]; |
24 |
|
|
BYTE AidManufacturer[2]; |
25 |
|
|
BYTE AidSerialNumber[4]; |
26 |
|
|
BYTE AidRFU[2]; |
27 |
|
|
} OPENPGP_AID; |
28 |
|
|
|
29 |
|
|
#define FEATURE_VERIFY_PIN_START 0x01 |
30 |
|
|
#define FEATURE_VERIFY_PIN_FINISH 0x02 |
31 |
|
|
#define FEATURE_MODIFY_PIN_START 0x03 |
32 |
|
|
#define FEATURE_MODIFY_PIN_FINISH 0x04 |
33 |
|
|
#define FEATURE_GET_KEY_PRESSED 0x05 |
34 |
|
|
#define FEATURE_VERIFY_PIN_DIRECT 0x06 |
35 |
|
|
#define FEATURE_MODIFY_PIN_DIRECT 0x07 |
36 |
|
|
#define FEATURE_MCT_READERDIRECT 0x08 |
37 |
|
|
#define FEATURE_MCT_UNIVERSAL 0x09 |
38 |
|
|
#define FEATURE_IFD_PIN_PROPERTIES 0x0A |
39 |
|
|
#define FEATURE_ABORT 0x0B |
40 |
|
|
|
41 |
|
|
typedef struct _FEATURES |
42 |
|
|
{ |
43 |
|
|
DWORD VERIFY_PIN_START; |
44 |
|
|
DWORD VERIFY_PIN_FINISH; |
45 |
|
|
DWORD VERIFY_PIN_DIRECT; |
46 |
|
|
DWORD MODIFY_PIN_START; |
47 |
|
|
DWORD MODIFY_PIN_FINISH; |
48 |
|
|
DWORD MODIFY_PIN_DIRECT; |
49 |
|
|
DWORD ABORT; |
50 |
|
|
DWORD GET_KEY_PRESSED; |
51 |
|
|
} FEATURES, *PFEATURES; |
52 |
|
|
|
53 |
vletoux |
9 |
#define KEYMAX 3 |
54 |
vletoux |
1 |
typedef struct _OPENPGP_CONTEXT |
55 |
|
|
{ |
56 |
|
|
OPENPGP_AID Aid; |
57 |
|
|
FEATURES SmartCardReaderFeatures; |
58 |
|
|
BOOL fSupportCommandChaining; |
59 |
|
|
BOOL fExtentedLeLcFields; |
60 |
vletoux |
6 |
DWORD dwMaxChallengeLength; |
61 |
|
|
DWORD dwMaxCertificateLength; |
62 |
|
|
DWORD dwMaxCommandDataLength; |
63 |
|
|
DWORD dwMaxResponseLength; |
64 |
vletoux |
9 |
BOOL fHasKey[KEYMAX]; |
65 |
vletoux |
8 |
BOOL fIsReadOnly; |
66 |
vletoux |
9 |
BYTE bFingerPrint[60]; |
67 |
vletoux |
10 |
PBYTE pbModulusInLittleEndian[KEYMAX]; |
68 |
|
|
WORD dwModulusSizeInBytes[KEYMAX]; |
69 |
|
|
DWORD dwExponent[KEYMAX]; |
70 |
|
|
LARGE_INTEGER LastCacheCheck[KEYMAX]; |
71 |
|
|
BOOL fDoesTheAdminHasBeenAuthenticatedAtLeastOnce; |
72 |
vletoux |
12 |
ALG_ID aiSecureMessagingAlg; |
73 |
vletoux |
1 |
} OPENPGP_CONTEXT, *POPENPGP_CONTEXT ; |
74 |
|
|
|
75 |
vletoux |
8 |
DWORD CreateContext(__in PCARD_DATA pCardData, __in DWORD dwFlags); |
76 |
vletoux |
1 |
DWORD CheckContext(__in PCARD_DATA pCardData); |
77 |
|
|
DWORD CleanContext(__in PCARD_DATA pCardData); |