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 |
|
|
typedef enum _OPENPGP_CONTAINER |
19 |
|
|
{ |
20 |
vletoux |
9 |
ContainerSignature, |
21 |
vletoux |
10 |
ContainerConfidentiality, |
22 |
vletoux |
9 |
ContainerAuthentication, |
23 |
|
|
ContainerMax |
24 |
vletoux |
1 |
} OPENPGP_CONTAINER; |
25 |
|
|
|
26 |
vletoux |
9 |
typedef enum _OPENPGP_KEY |
27 |
vletoux |
1 |
{ |
28 |
vletoux |
9 |
KeySignature, |
29 |
vletoux |
10 |
KeyConfidentiality, |
30 |
vletoux |
9 |
KeyAuthentication, |
31 |
|
|
KeyMax |
32 |
|
|
} OPENPGP_KEY; |
33 |
|
|
|
34 |
|
|
typedef struct _OPENPGP_KEY_INFO |
35 |
|
|
{ |
36 |
vletoux |
3 |
BYTE bKeyTag; |
37 |
|
|
BYTE bDateTimeTag; |
38 |
|
|
BYTE bSignatureTag; |
39 |
|
|
ALG_ID aiKeyAlg; |
40 |
vletoux |
9 |
} OPENPGP_KEY_INFO, *POPENPGP_KEY_INFO; |
41 |
|
|
|
42 |
|
|
extern OPENPGP_KEY_INFO Keys[]; |
43 |
|
|
|
44 |
|
|
typedef struct _OPENPGP_CONTAINER_INFO |
45 |
|
|
{ |
46 |
vletoux |
1 |
PIN_ID PinId; |
47 |
vletoux |
9 |
DWORD dwKeySpec; |
48 |
vletoux |
1 |
} OPENPGP_CONTAINER_INFO, *POPENPGP_CONTAINER_INFO; |
49 |
|
|
|
50 |
|
|
extern OPENPGP_CONTAINER_INFO Containers[]; |
51 |
|
|
|
52 |
|
|
#define OPENPGP_SUPPORTED_CYPHER_ALGORITHM L"\0" |
53 |
|
|
#define OPENPGP_SUPPORTED_ASYMETRIC_ALGORITHM L"RSA\0" |
54 |
|
|
|
55 |
vletoux |
8 |
#pragma pack(push,1) |
56 |
|
|
typedef struct _OPENPGP_ALGORITHM_ATTRIBUTE |
57 |
|
|
{ |
58 |
|
|
BYTE bAlgoId; |
59 |
|
|
unsigned short wModulusLengthInBit; |
60 |
|
|
unsigned short wExponentLengthInBit; |
61 |
|
|
BYTE bFormat; |
62 |
|
|
} OPENPGP_ALGORITHM_ATTRIBUTE, *POPENPGP_ALGORITHM_ATTRIBUTE; |
63 |
|
|
#pragma pack(pop) |
64 |
|
|
|
65 |
|
|
DWORD OCardReadPublicKey(PCARD_DATA pCardData, |
66 |
vletoux |
9 |
OPENPGP_KEY dwKey, |
67 |
vletoux |
1 |
PBYTE *pbPublicKey, PDWORD pdwPublicKeySize); |
68 |
|
|
|
69 |
vletoux |
9 |
DWORD OCardCreateKey(PCARD_DATA pCardData, OPENPGP_KEY dwKey, DWORD dwBitLen); |
70 |
vletoux |
1 |
|
71 |
vletoux |
8 |
DWORD OCardImportKey(PCARD_DATA pCardData, |
72 |
vletoux |
9 |
OPENPGP_KEY dwKey, |
73 |
vletoux |
1 |
PBYTE pBlob, |
74 |
|
|
DWORD dwKeySize); |
75 |
|
|
|
76 |
vletoux |
8 |
DWORD OCardSign(PCARD_DATA pCardData, |
77 |
vletoux |
1 |
PCARD_SIGNING_INFO pInfo); |
78 |
|
|
|
79 |
vletoux |
8 |
DWORD OCardAuthenticate(PCARD_DATA pCardData, |
80 |
vletoux |
5 |
PCARD_SIGNING_INFO pInfo); |
81 |
|
|
|
82 |
vletoux |
8 |
DWORD OCardDecrypt(PCARD_DATA pCardData, |
83 |
vletoux |
1 |
PCARD_RSA_DECRYPT_INFO pInfo); |
84 |
|
|
|
85 |
vletoux |
9 |
DWORD OCardReadContainerMapFile(__in PCARD_DATA pCardData, |
86 |
vletoux |
10 |
__in PBYTE* ppbResponse, __in PDWORD pdwResponseSize); |
87 |
|
|
|
88 |
|
|
DWORD OCardGetKeyLengthInBytes(__in PCARD_DATA pCardData, __in OPENPGP_KEY dwKey, |
89 |
|
|
__out PDWORD pdwLengthInBytes); |
90 |
|
|
|
91 |
|
|
DWORD OCardIsConfidentialityKeyTheSameThanAuthentication(__in PCARD_DATA pCardData); |