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 |
|
|
Signature, |
21 |
|
|
Authentication, |
22 |
|
|
Confidentiality, |
23 |
|
|
MaxContainer |
24 |
|
|
} OPENPGP_CONTAINER; |
25 |
|
|
|
26 |
|
|
typedef struct _OPENPGP_CONTAINER_INFO |
27 |
|
|
{ |
28 |
vletoux |
3 |
BYTE bKeyTag; |
29 |
|
|
BYTE bDateTimeTag; |
30 |
|
|
BYTE bSignatureTag; |
31 |
|
|
ALG_ID aiKeyAlg; |
32 |
|
|
DWORD dwKeySpec; |
33 |
vletoux |
1 |
PIN_ID PinId; |
34 |
|
|
} OPENPGP_CONTAINER_INFO, *POPENPGP_CONTAINER_INFO; |
35 |
|
|
|
36 |
|
|
extern OPENPGP_CONTAINER_INFO Containers[]; |
37 |
|
|
|
38 |
|
|
#define OPENPGP_SUPPORTED_CYPHER_ALGORITHM L"\0" |
39 |
|
|
#define OPENPGP_SUPPORTED_ASYMETRIC_ALGORITHM L"RSA\0" |
40 |
|
|
|
41 |
vletoux |
8 |
#pragma pack(push,1) |
42 |
|
|
typedef struct _OPENPGP_ALGORITHM_ATTRIBUTE |
43 |
|
|
{ |
44 |
|
|
BYTE bAlgoId; |
45 |
|
|
unsigned short wModulusLengthInBit; |
46 |
|
|
unsigned short wExponentLengthInBit; |
47 |
|
|
BYTE bFormat; |
48 |
|
|
} OPENPGP_ALGORITHM_ATTRIBUTE, *POPENPGP_ALGORITHM_ATTRIBUTE; |
49 |
|
|
#pragma pack(pop) |
50 |
|
|
|
51 |
|
|
DWORD OCardReadPublicKey(PCARD_DATA pCardData, |
52 |
vletoux |
1 |
OPENPGP_CONTAINER dwContainer, |
53 |
|
|
PBYTE *pbPublicKey, PDWORD pdwPublicKeySize); |
54 |
|
|
|
55 |
vletoux |
8 |
DWORD OCardCreateKey(PCARD_DATA pCardData, OPENPGP_CONTAINER dwContainer, DWORD dwBitLen); |
56 |
vletoux |
1 |
|
57 |
vletoux |
8 |
DWORD OCardImportKey(PCARD_DATA pCardData, |
58 |
vletoux |
1 |
OPENPGP_CONTAINER dwContainer, |
59 |
|
|
PBYTE pBlob, |
60 |
|
|
DWORD dwKeySize); |
61 |
|
|
|
62 |
vletoux |
8 |
DWORD OCardSign(PCARD_DATA pCardData, |
63 |
vletoux |
1 |
PCARD_SIGNING_INFO pInfo); |
64 |
|
|
|
65 |
vletoux |
8 |
DWORD OCardAuthenticate(PCARD_DATA pCardData, |
66 |
vletoux |
5 |
PCARD_SIGNING_INFO pInfo); |
67 |
|
|
|
68 |
vletoux |
8 |
DWORD OCardDecrypt(PCARD_DATA pCardData, |
69 |
vletoux |
1 |
PCARD_RSA_DECRYPT_INFO pInfo); |
70 |
|
|
|