pkcs11_luna 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/.gemtest +0 -0
- data/.yardopts +1 -0
- data/Manifest.txt +24 -0
- data/README_LUNA.rdoc +103 -0
- data/Rakefile +88 -0
- data/examples/config.rb +5 -0
- data/examples/derive_aes_ecdh_key.rb +108 -0
- data/examples/encrypt_decrypt_aes.rb +41 -0
- data/examples/encrypt_decrypt_rsa.rb +47 -0
- data/examples/mechanism_list.rb +20 -0
- data/examples/multithread.rb +73 -0
- data/examples/objects_list.rb +23 -0
- data/examples/sign_verify.rb +56 -0
- data/examples/slot_info.rb +23 -0
- data/ext/extconf.rb +14 -0
- data/ext/generate_constants.rb +57 -0
- data/ext/generate_structs.rb +77 -0
- data/ext/pk11_const_macros.h +38 -0
- data/ext/pk11_struct_macros.h +435 -0
- data/ext/pk11_version.h +6 -0
- data/ext/pk11l.c +352 -0
- data/ext/pk11l_const_def.inc +804 -0
- data/ext/pk11l_struct.doc +1012 -0
- data/ext/pk11l_struct_def.inc +388 -0
- data/ext/pk11l_struct_impl.inc +388 -0
- data/lib/pkcs11_luna/extensions.rb +131 -0
- data/lib/pkcs11_luna.rb +11 -0
- data/test/app_id_helper.rb +29 -0
- data/test/luna_helper.rb +57 -0
- data/test/test_pkcs11_luna.rb +112 -0
- data/test/test_pkcs11_luna_crypt.rb +260 -0
- data.tar.gz.sig +0 -0
- metadata +173 -0
- metadata.gz.sig +1 -0
@@ -0,0 +1,388 @@
|
|
1
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_VERSION);
|
2
|
+
PKCS11_IMPLEMENT_BYTE_ACCESSOR(CK_VERSION, major);
|
3
|
+
PKCS11_IMPLEMENT_BYTE_ACCESSOR(CK_VERSION, minor);
|
4
|
+
|
5
|
+
PKCS11_IMPLEMENT_ALLOCATOR(CK_INFO);
|
6
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_INFO, CK_VERSION, cryptokiVersion);
|
7
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_INFO, manufacturerID);
|
8
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_INFO, flags);
|
9
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_INFO, libraryDescription);
|
10
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_INFO, CK_VERSION, libraryVersion);
|
11
|
+
|
12
|
+
PKCS11_IMPLEMENT_ALLOCATOR(CK_SLOT_INFO);
|
13
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_SLOT_INFO, slotDescription);
|
14
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_SLOT_INFO, manufacturerID);
|
15
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SLOT_INFO, flags);
|
16
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_SLOT_INFO, CK_VERSION, hardwareVersion);
|
17
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_SLOT_INFO, CK_VERSION, firmwareVersion);
|
18
|
+
|
19
|
+
PKCS11_IMPLEMENT_ALLOCATOR(CK_TOKEN_INFO);
|
20
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_TOKEN_INFO, label);
|
21
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_TOKEN_INFO, manufacturerID);
|
22
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_TOKEN_INFO, model);
|
23
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_TOKEN_INFO, serialNumber);
|
24
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, flags);
|
25
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulMaxSessionCount);
|
26
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulSessionCount);
|
27
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulMaxRwSessionCount);
|
28
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulRwSessionCount);
|
29
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulMaxPinLen);
|
30
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulMinPinLen);
|
31
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulTotalPublicMemory);
|
32
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulFreePublicMemory);
|
33
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulTotalPrivateMemory);
|
34
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_TOKEN_INFO, ulFreePrivateMemory);
|
35
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_TOKEN_INFO, CK_VERSION, hardwareVersion);
|
36
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_TOKEN_INFO, CK_VERSION, firmwareVersion);
|
37
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_TOKEN_INFO, utcTime);
|
38
|
+
|
39
|
+
PKCS11_IMPLEMENT_ALLOCATOR(CK_SESSION_INFO);
|
40
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SESSION_INFO, slotID);
|
41
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SESSION_INFO, state);
|
42
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SESSION_INFO, flags);
|
43
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SESSION_INFO, ulDeviceError);
|
44
|
+
|
45
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_DATE);
|
46
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DATE, year);
|
47
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DATE, month);
|
48
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DATE, day);
|
49
|
+
|
50
|
+
PKCS11_IMPLEMENT_ALLOCATOR(CK_MECHANISM_INFO);
|
51
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_MECHANISM_INFO, ulMinKeySize);
|
52
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_MECHANISM_INFO, ulMaxKeySize);
|
53
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_MECHANISM_INFO, flags);
|
54
|
+
|
55
|
+
PKCS11_IMPLEMENT_ALLOCATOR(CK_C_INITIALIZE_ARGS);
|
56
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_C_INITIALIZE_ARGS, pReserved);
|
57
|
+
/* unimplemented attr CK_CREATEMUTEX CreateMutex */
|
58
|
+
/* unimplemented attr CK_DESTROYMUTEX DestroyMutex */
|
59
|
+
/* unimplemented attr CK_LOCKMUTEX LockMutex */
|
60
|
+
/* unimplemented attr CK_UNLOCKMUTEX UnlockMutex */
|
61
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_C_INITIALIZE_ARGS, flags);
|
62
|
+
|
63
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RSA_PKCS_OAEP_PARAMS);
|
64
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_RSA_PKCS_OAEP_PARAMS, pSourceData, ulSourceDataLen);
|
65
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RSA_PKCS_OAEP_PARAMS, hashAlg);
|
66
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RSA_PKCS_OAEP_PARAMS, mgf);
|
67
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RSA_PKCS_OAEP_PARAMS, source);
|
68
|
+
|
69
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RSA_PKCS_PSS_PARAMS);
|
70
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RSA_PKCS_PSS_PARAMS, hashAlg);
|
71
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RSA_PKCS_PSS_PARAMS, mgf);
|
72
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RSA_PKCS_PSS_PARAMS, sLen);
|
73
|
+
|
74
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_ECDH1_DERIVE_PARAMS);
|
75
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ECDH1_DERIVE_PARAMS, pSharedData, ulSharedDataLen);
|
76
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ECDH1_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
77
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECDH1_DERIVE_PARAMS, kdf);
|
78
|
+
|
79
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_ECDH2_DERIVE_PARAMS);
|
80
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, pSharedData, ulSharedDataLen);
|
81
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
82
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, pPublicData2);
|
83
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, kdf);
|
84
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, ulPrivateDataLen);
|
85
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, hPrivateData);
|
86
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECDH2_DERIVE_PARAMS, ulPublicDataLen2);
|
87
|
+
|
88
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_ECMQV_DERIVE_PARAMS);
|
89
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, pSharedData, ulSharedDataLen);
|
90
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
91
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, pPublicData2);
|
92
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, kdf);
|
93
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, ulPrivateDataLen);
|
94
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, hPrivateData);
|
95
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, ulPublicDataLen2);
|
96
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_ECMQV_DERIVE_PARAMS, publicKey);
|
97
|
+
|
98
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_X9_42_DH1_DERIVE_PARAMS);
|
99
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_X9_42_DH1_DERIVE_PARAMS, pOtherInfo, ulOtherInfoLen);
|
100
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_X9_42_DH1_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
101
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_DH1_DERIVE_PARAMS, kdf);
|
102
|
+
|
103
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_X9_42_DH2_DERIVE_PARAMS);
|
104
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, pOtherInfo, ulOtherInfoLen);
|
105
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
106
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, pPublicData2);
|
107
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, kdf);
|
108
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, ulPrivateDataLen);
|
109
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, hPrivateData);
|
110
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_DH2_DERIVE_PARAMS, ulPublicDataLen2);
|
111
|
+
|
112
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_X9_42_MQV_DERIVE_PARAMS);
|
113
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, pOtherInfo, ulOtherInfoLen);
|
114
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
115
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, pPublicData2);
|
116
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, kdf);
|
117
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, ulPrivateDataLen);
|
118
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, hPrivateData);
|
119
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, ulPublicDataLen2);
|
120
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_X9_42_MQV_DERIVE_PARAMS, publicKey);
|
121
|
+
|
122
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_KEA_DERIVE_PARAMS);
|
123
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_KEA_DERIVE_PARAMS, pRandomA);
|
124
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_KEA_DERIVE_PARAMS, pRandomB);
|
125
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_KEA_DERIVE_PARAMS, pPublicData, ulPublicDataLen);
|
126
|
+
PKCS11_IMPLEMENT_BOOL_ACCESSOR(CK_KEA_DERIVE_PARAMS, isSender);
|
127
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_KEA_DERIVE_PARAMS, ulRandomLen);
|
128
|
+
|
129
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RC2_CBC_PARAMS);
|
130
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC2_CBC_PARAMS, ulEffectiveBits);
|
131
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_RC2_CBC_PARAMS, iv);
|
132
|
+
|
133
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RC2_MAC_GENERAL_PARAMS);
|
134
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC2_MAC_GENERAL_PARAMS, ulEffectiveBits);
|
135
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC2_MAC_GENERAL_PARAMS, ulMacLength);
|
136
|
+
|
137
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RC5_PARAMS);
|
138
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_PARAMS, ulWordsize);
|
139
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_PARAMS, ulRounds);
|
140
|
+
|
141
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RC5_CBC_PARAMS);
|
142
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_RC5_CBC_PARAMS, pIv, ulIvLen);
|
143
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_CBC_PARAMS, ulWordsize);
|
144
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_CBC_PARAMS, ulRounds);
|
145
|
+
|
146
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_RC5_MAC_GENERAL_PARAMS);
|
147
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_MAC_GENERAL_PARAMS, ulWordsize);
|
148
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_MAC_GENERAL_PARAMS, ulRounds);
|
149
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_RC5_MAC_GENERAL_PARAMS, ulMacLength);
|
150
|
+
|
151
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_DES_CBC_ENCRYPT_DATA_PARAMS);
|
152
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_DES_CBC_ENCRYPT_DATA_PARAMS, pData, length);
|
153
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES_CBC_ENCRYPT_DATA_PARAMS, iv);
|
154
|
+
|
155
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_AES_CBC_ENCRYPT_DATA_PARAMS);
|
156
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_AES_CBC_ENCRYPT_DATA_PARAMS, pData, length);
|
157
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_AES_CBC_ENCRYPT_DATA_PARAMS, iv);
|
158
|
+
|
159
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS);
|
160
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, pPassword, ulPasswordLen);
|
161
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, pPublicData, ulPublicDataLen);
|
162
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, pRandomA);
|
163
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, pPrimeP);
|
164
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, pBaseG);
|
165
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, pSubprimeQ);
|
166
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, ulPAndGLen);
|
167
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, ulQLen);
|
168
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SKIPJACK_PRIVATE_WRAP_PARAMS, ulRandomLen);
|
169
|
+
|
170
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SKIPJACK_RELAYX_PARAMS);
|
171
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pOldWrappedX, ulOldWrappedXLen);
|
172
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pOldPassword, ulOldPasswordLen);
|
173
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pOldPublicData, ulOldPublicDataLen);
|
174
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pOldRandomA);
|
175
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pNewPassword, ulNewPasswordLen);
|
176
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pNewPublicData, ulNewPublicDataLen);
|
177
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, pNewRandomA);
|
178
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, ulOldRandomLen);
|
179
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SKIPJACK_RELAYX_PARAMS, ulNewRandomLen);
|
180
|
+
|
181
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_PBE_PARAMS);
|
182
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_PBE_PARAMS, pInitVector);
|
183
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PBE_PARAMS, pPassword, ulPasswordLen);
|
184
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PBE_PARAMS, pSalt, ulSaltLen);
|
185
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PBE_PARAMS, ulIteration);
|
186
|
+
|
187
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_KEY_WRAP_SET_OAEP_PARAMS);
|
188
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_KEY_WRAP_SET_OAEP_PARAMS, pX, ulXLen);
|
189
|
+
PKCS11_IMPLEMENT_BYTE_ACCESSOR(CK_KEY_WRAP_SET_OAEP_PARAMS, bBC);
|
190
|
+
|
191
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SSL3_RANDOM_DATA);
|
192
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SSL3_RANDOM_DATA, pClientRandom, ulClientRandomLen);
|
193
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_SSL3_RANDOM_DATA, pServerRandom, ulServerRandomLen);
|
194
|
+
|
195
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SSL3_MASTER_KEY_DERIVE_PARAMS);
|
196
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_SSL3_MASTER_KEY_DERIVE_PARAMS, CK_SSL3_RANDOM_DATA, RandomInfo);
|
197
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_SSL3_MASTER_KEY_DERIVE_PARAMS, CK_VERSION, pVersion);
|
198
|
+
|
199
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SSL3_KEY_MAT_OUT);
|
200
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SSL3_KEY_MAT_OUT, pIVClient);
|
201
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_SSL3_KEY_MAT_OUT, pIVServer);
|
202
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_SSL3_KEY_MAT_OUT, hClientMacSecret);
|
203
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_SSL3_KEY_MAT_OUT, hServerMacSecret);
|
204
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_SSL3_KEY_MAT_OUT, hClientKey);
|
205
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_SSL3_KEY_MAT_OUT, hServerKey);
|
206
|
+
|
207
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SSL3_KEY_MAT_PARAMS);
|
208
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SSL3_KEY_MAT_PARAMS, ulMacSizeInBits);
|
209
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SSL3_KEY_MAT_PARAMS, ulKeySizeInBits);
|
210
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SSL3_KEY_MAT_PARAMS, ulIVSizeInBits);
|
211
|
+
PKCS11_IMPLEMENT_BOOL_ACCESSOR(CK_SSL3_KEY_MAT_PARAMS, bIsExport);
|
212
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_SSL3_KEY_MAT_PARAMS, CK_SSL3_RANDOM_DATA, RandomInfo);
|
213
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_SSL3_KEY_MAT_PARAMS, CK_SSL3_KEY_MAT_OUT, pReturnedKeyMaterial);
|
214
|
+
|
215
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_TLS_PRF_PARAMS);
|
216
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_TLS_PRF_PARAMS, pSeed, ulSeedLen);
|
217
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_TLS_PRF_PARAMS, pLabel, ulLabelLen);
|
218
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_TLS_PRF_PARAMS, pOutput);
|
219
|
+
PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(CK_TLS_PRF_PARAMS, pulOutputLen);
|
220
|
+
|
221
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_WTLS_RANDOM_DATA);
|
222
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_WTLS_RANDOM_DATA, pClientRandom, ulClientRandomLen);
|
223
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_WTLS_RANDOM_DATA, pServerRandom, ulServerRandomLen);
|
224
|
+
|
225
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_WTLS_MASTER_KEY_DERIVE_PARAMS);
|
226
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_WTLS_MASTER_KEY_DERIVE_PARAMS, pVersion);
|
227
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_MASTER_KEY_DERIVE_PARAMS, DigestMechanism);
|
228
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_WTLS_MASTER_KEY_DERIVE_PARAMS, CK_WTLS_RANDOM_DATA, RandomInfo);
|
229
|
+
|
230
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_WTLS_PRF_PARAMS);
|
231
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_WTLS_PRF_PARAMS, pSeed, ulSeedLen);
|
232
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_WTLS_PRF_PARAMS, pLabel, ulLabelLen);
|
233
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_WTLS_PRF_PARAMS, pOutput);
|
234
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_PRF_PARAMS, DigestMechanism);
|
235
|
+
PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(CK_WTLS_PRF_PARAMS, pulOutputLen);
|
236
|
+
|
237
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_WTLS_KEY_MAT_OUT);
|
238
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_WTLS_KEY_MAT_OUT, pIV);
|
239
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_WTLS_KEY_MAT_OUT, hMacSecret);
|
240
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_WTLS_KEY_MAT_OUT, hKey);
|
241
|
+
|
242
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_WTLS_KEY_MAT_PARAMS);
|
243
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, DigestMechanism);
|
244
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, ulMacSizeInBits);
|
245
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, ulKeySizeInBits);
|
246
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, ulIVSizeInBits);
|
247
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, ulSequenceNumber);
|
248
|
+
PKCS11_IMPLEMENT_BOOL_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, bIsExport);
|
249
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, CK_WTLS_RANDOM_DATA, RandomInfo);
|
250
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_WTLS_KEY_MAT_PARAMS, CK_WTLS_KEY_MAT_OUT, pReturnedKeyMaterial);
|
251
|
+
|
252
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_CMS_SIG_PARAMS);
|
253
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_CMS_SIG_PARAMS, pContentType);
|
254
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_CMS_SIG_PARAMS, pRequestedAttributes, ulRequestedAttributesLen);
|
255
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_CMS_SIG_PARAMS, pRequiredAttributes, ulRequiredAttributesLen);
|
256
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_CMS_SIG_PARAMS, certificateHandle);
|
257
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_CMS_SIG_PARAMS, CK_MECHANISM, pSigningMechanism);
|
258
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_CMS_SIG_PARAMS, CK_MECHANISM, pDigestMechanism);
|
259
|
+
|
260
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_KEY_DERIVATION_STRING_DATA);
|
261
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_KEY_DERIVATION_STRING_DATA, pData, ulLen);
|
262
|
+
|
263
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_PKCS5_PBKD2_PARAMS);
|
264
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS5_PBKD2_PARAMS, pSaltSourceData, ulSaltSourceDataLen);
|
265
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS5_PBKD2_PARAMS, pPrfData, ulPrfDataLen);
|
266
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS5_PBKD2_PARAMS, pPassword, ulPasswordLen);
|
267
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PKCS5_PBKD2_PARAMS, saltSource);
|
268
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PKCS5_PBKD2_PARAMS, iterations);
|
269
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PKCS5_PBKD2_PARAMS, prf);
|
270
|
+
|
271
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_OTP_PARAM);
|
272
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_OTP_PARAM, pValue, ulValueLen);
|
273
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_OTP_PARAM, type);
|
274
|
+
|
275
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_OTP_PARAMS);
|
276
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_OTP_PARAMS, CK_OTP_PARAM, pParams);
|
277
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_OTP_PARAMS, ulCount);
|
278
|
+
|
279
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_OTP_SIGNATURE_INFO);
|
280
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_OTP_SIGNATURE_INFO, CK_OTP_PARAM, pParams);
|
281
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_OTP_SIGNATURE_INFO, ulCount);
|
282
|
+
|
283
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_KIP_PARAMS);
|
284
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_KIP_PARAMS, pSeed, ulSeedLen);
|
285
|
+
PKCS11_IMPLEMENT_STRUCT_PTR_ACCESSOR(CK_KIP_PARAMS, CK_MECHANISM, pMechanism);
|
286
|
+
PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_KIP_PARAMS, hKey);
|
287
|
+
|
288
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_AES_CTR_PARAMS);
|
289
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CTR_PARAMS, ulCounterBits);
|
290
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_AES_CTR_PARAMS, cb);
|
291
|
+
|
292
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_CAMELLIA_CTR_PARAMS);
|
293
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_CAMELLIA_CTR_PARAMS, ulCounterBits);
|
294
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_CAMELLIA_CTR_PARAMS, cb);
|
295
|
+
|
296
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS);
|
297
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS, pData, length);
|
298
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS, iv);
|
299
|
+
|
300
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS);
|
301
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS, pData, length);
|
302
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS, iv);
|
303
|
+
|
304
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_AES_GCM_PARAMS);
|
305
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_AES_GCM_PARAMS, pIv, ulIvLen);
|
306
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_AES_GCM_PARAMS, pAAD, ulAADLen);
|
307
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_GCM_PARAMS, ulIvBits);
|
308
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_GCM_PARAMS, ulTagBits);
|
309
|
+
|
310
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_XOR_BASE_DATA_KDF_PARAMS);
|
311
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_XOR_BASE_DATA_KDF_PARAMS, pSharedData, ulSharedDataLen);
|
312
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_XOR_BASE_DATA_KDF_PARAMS, kdf);
|
313
|
+
|
314
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_ECIES_PARAMS);
|
315
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECIES_PARAMS, pSharedData1);
|
316
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECIES_PARAMS, pSharedData2);
|
317
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, dhPrimitive);
|
318
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, kdf);
|
319
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, ulSharedDataLen1);
|
320
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, encScheme);
|
321
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, ulEncKeyLenInBits);
|
322
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, macScheme);
|
323
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, ulMacKeyLenInBits);
|
324
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, ulMacLenInBits);
|
325
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, ulSharedDataLen2);
|
326
|
+
|
327
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_PRF_KDF_PARAMS);
|
328
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PRF_KDF_PARAMS, pLabel, ulLabelLen);
|
329
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PRF_KDF_PARAMS, pContext, ulContextLen);
|
330
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PRF_KDF_PARAMS, prfType);
|
331
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PRF_KDF_PARAMS, ulCounter);
|
332
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PRF_KDF_PARAMS, ulEncodingScheme);
|
333
|
+
|
334
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_DES_CTR_PARAMS);
|
335
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_DES_CTR_PARAMS, ulCounterBits);
|
336
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES_CTR_PARAMS, cb);
|
337
|
+
|
338
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CA_MOFN_STATUS);
|
339
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CA_MOFN_STATUS, ulID);
|
340
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CA_MOFN_STATUS, ulM);
|
341
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CA_MOFN_STATUS, ulN);
|
342
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CA_MOFN_STATUS, ulSecretSize);
|
343
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CA_MOFN_STATUS, ulFlag);
|
344
|
+
|
345
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CKCA_MODULE_INFO);
|
346
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CKCA_MODULE_INFO, ulModuleSize);
|
347
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CKCA_MODULE_INFO, developerName);
|
348
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CKCA_MODULE_INFO, moduleDescription);
|
349
|
+
PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CKCA_MODULE_INFO, CK_VERSION, moduleVersion);
|
350
|
+
|
351
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_HA_MEMBER);
|
352
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_HA_MEMBER, memberSerial);
|
353
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_HA_MEMBER, memberStatus);
|
354
|
+
|
355
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_HA_STATUS);
|
356
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_HA_STATUS, groupSerial);
|
357
|
+
/* unimplemented attr CK_HA_MEMBER memberList 32 */
|
358
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_HA_STATUS, listSize);
|
359
|
+
|
360
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_AES_CBC_PAD_EXTRACT_PARAMS);
|
361
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, pBuffer);
|
362
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, pbFileName);
|
363
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, ulType);
|
364
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, ulHandle);
|
365
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, ulDeleteAfterExtract);
|
366
|
+
PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, pulBufferLen);
|
367
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, ulStorage);
|
368
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, pedId);
|
369
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_EXTRACT_PARAMS, ctxID);
|
370
|
+
|
371
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_AES_CBC_PAD_INSERT_PARAMS);
|
372
|
+
PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, pBuffer, ulBufferLen);
|
373
|
+
PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, pbFileName);
|
374
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, ulStorageType);
|
375
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, ulContainerState);
|
376
|
+
PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, pulType);
|
377
|
+
PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, pulHandle);
|
378
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, ulStorage);
|
379
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, pedId);
|
380
|
+
PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_AES_CBC_PAD_INSERT_PARAMS, ctxID);
|
381
|
+
|
382
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_CLUSTER_STATE);
|
383
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_CLUSTER_STATE, bMembers);
|
384
|
+
/* unimplemented attr CK_ULONG ulMemberStatus CK_MAX_CLUSTER_MEMBERS */
|
385
|
+
|
386
|
+
PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_LKM_TOKEN_ID);
|
387
|
+
PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_LKM_TOKEN_ID, id);
|
388
|
+
|
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module PKCS11
|
4
|
+
module Luna
|
5
|
+
# Derive CK_ATTRIBUTE to get converted attributes.
|
6
|
+
class CK_ATTRIBUTE < PKCS11::CK_ATTRIBUTE
|
7
|
+
|
8
|
+
ATTRIBUTES = {
|
9
|
+
CKA_CCM_PRIVATE => :bool,
|
10
|
+
CKA_X9_31_GENERATED => :bool,
|
11
|
+
CKA_USAGE_COUNT => :ulong,
|
12
|
+
CKA_USAGE_LIMIT => :ulong
|
13
|
+
}
|
14
|
+
|
15
|
+
def value
|
16
|
+
case ATTRIBUTES[type]
|
17
|
+
when :bool
|
18
|
+
super != "\0"
|
19
|
+
when :ulong
|
20
|
+
super.unpack("L!")[0]
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# A Luna::Library instance holds a handle to the opened +cryptoki.dll+ or +cryptoki.so+ file.
|
28
|
+
#
|
29
|
+
# This class is derived from
|
30
|
+
# PKCS11::Library[http://pkcs11.rubyforge.org/pkcs11/PKCS11/Library.html] of pkcs11.gem.
|
31
|
+
class Library < PKCS11::Library
|
32
|
+
MechanismParameters = {
|
33
|
+
CKM_AES_GCM => CK_AES_GCM_PARAMS,
|
34
|
+
CKM_ECIES => CK_ECIES_PARAMS,
|
35
|
+
CKM_XOR_BASE_AND_DATA_W_KDF => CK_XOR_BASE_DATA_KDF_PARAMS,
|
36
|
+
CKM_PRF_KDF => CK_PRF_KDF_PARAMS,
|
37
|
+
CKM_NIST_PRF_KDF => CK_PRF_KDF_PARAMS,
|
38
|
+
CKM_SEED_CTR => CK_AES_CTR_PARAMS,
|
39
|
+
CKM_AES_CTR => CK_AES_CTR_PARAMS,
|
40
|
+
CKM_DES3_CTR => CK_DES_CTR_PARAMS,
|
41
|
+
CKM_AES_GMAC => CK_AES_GCM_PARAMS,
|
42
|
+
CKM_AES_CBC_PAD_EXTRACT => CK_AES_CBC_PAD_EXTRACT_PARAMS,
|
43
|
+
CKM_AES_CBC_PAD_INSERT => CK_AES_CBC_PAD_INSERT_PARAMS,
|
44
|
+
CKM_AES_CBC_PAD_EXTRACT_FLATTENED => CK_AES_CBC_PAD_EXTRACT_PARAMS,
|
45
|
+
CKM_AES_CBC_PAD_INSERT_FLATTENED => CK_AES_CBC_PAD_INSERT_PARAMS,
|
46
|
+
CKM_PKCS5_PBKD2 => Luna::CK_PKCS5_PBKD2_PARAMS
|
47
|
+
}
|
48
|
+
|
49
|
+
# Path and file name of the loaded cryptoki library.
|
50
|
+
attr_reader :so_path
|
51
|
+
|
52
|
+
# Load and initialize a pkcs11 dynamic library with Safenet Luna extensions.
|
53
|
+
#
|
54
|
+
# Set +so_path+ to +:config+, in order to autodetect the .dll or .so or
|
55
|
+
# set it to the full path of the .dll or .so file.
|
56
|
+
#
|
57
|
+
# @param [String, Symbol] so_path Shortcut-Symbol or path to the *.so or *.dll file to load.
|
58
|
+
# @param [Hash, CK_C_INITIALIZE_ARGS] args A Hash or CK_C_INITIALIZE_ARGS instance with load params.
|
59
|
+
#
|
60
|
+
# See also PKCS11::Library#initialize[http://pkcs11.rubyforge.org/pkcs11/PKCS11/Library.html#initialize-instance_method] of pkcs11.gem
|
61
|
+
alias unwrapped_initialize initialize
|
62
|
+
def initialize(so_path = :config, args = {})
|
63
|
+
unwrapped_initialize(so_path, args)
|
64
|
+
end
|
65
|
+
|
66
|
+
def load_library(so_path)
|
67
|
+
@so_path = resolve_so_path(so_path)
|
68
|
+
super(@so_path)
|
69
|
+
end
|
70
|
+
|
71
|
+
def resolve_so_path(so_path)
|
72
|
+
if so_path == :config
|
73
|
+
if RUBY_PLATFORM =~ /mswin|mingw/
|
74
|
+
config_file = File.join(ENV['ChrystokiConfigurationPath'], 'crystoki.ini')
|
75
|
+
config_content = File.read(config_file)
|
76
|
+
config_content.scan(/\[Chrystoki2\](.*?)\[/m) do |crystoki2|
|
77
|
+
section = $1
|
78
|
+
lib = 'LibNT'
|
79
|
+
section.scan(/#{lib}\s*=\s*(.*)/) do |lib_path|
|
80
|
+
return $1
|
81
|
+
end
|
82
|
+
end
|
83
|
+
so_path = "C:\\Program Files\\SafeNet\\LunaClient\\win32\\cryptoki.dll"
|
84
|
+
else
|
85
|
+
config_content = File.read('/etc/Chrystoki.conf')
|
86
|
+
config_content.scan(/Chrystoki2.*?\{(.*?)\}/m) do |crystoki2|
|
87
|
+
section = $1
|
88
|
+
lib = if ['a'].pack("p").size == 8 then 'LibUNIX64' else 'LibUNIX' end
|
89
|
+
section.scan(/#{lib}\s*=\s*(.*);/) do |lib_path|
|
90
|
+
return $1
|
91
|
+
end
|
92
|
+
end
|
93
|
+
so_path = '/usr/lib/libCryptoki2_64.so'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
so_path
|
97
|
+
end
|
98
|
+
|
99
|
+
private :resolve_so_path
|
100
|
+
|
101
|
+
|
102
|
+
def vendor_const_get(name)
|
103
|
+
return Luna.const_get(name) if Luna.const_defined?(name)
|
104
|
+
super
|
105
|
+
end
|
106
|
+
|
107
|
+
def vendor_all_attribute_names
|
108
|
+
return Luna::ATTRIBUTES.values + super
|
109
|
+
end
|
110
|
+
|
111
|
+
def vendor_mechanism_parameter_struct(mech)
|
112
|
+
MechanismParameters[mech] || super
|
113
|
+
end
|
114
|
+
|
115
|
+
def vendor_raise_on_return_value(rv)
|
116
|
+
if ex=PKCS11::RETURN_VALUES[rv]
|
117
|
+
raise(ex, rv.to_s)
|
118
|
+
end
|
119
|
+
if ex=Luna::RETURN_VALUES[rv]
|
120
|
+
raise(ex, rv.to_s)
|
121
|
+
end
|
122
|
+
super
|
123
|
+
end
|
124
|
+
|
125
|
+
def vendor_class_CK_ATTRIBUTE
|
126
|
+
Luna::CK_ATTRIBUTE
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
data/lib/pkcs11_luna.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Extend the search path for Windows binary gem, depending of the current ruby version
|
4
|
+
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
|
5
|
+
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
|
6
|
+
$: << File.join(File.dirname(__FILE__), major_minor)
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'pkcs11'
|
10
|
+
require 'pkcs11_luna_ext'
|
11
|
+
require 'pkcs11_luna/extensions'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "pkcs11_luna"
|
3
|
+
|
4
|
+
include PKCS11
|
5
|
+
|
6
|
+
slot_id = ARGV[0]
|
7
|
+
|
8
|
+
pkcs11 = Luna::Library.new
|
9
|
+
slot = Luna::Slot.new(pkcs11, slot_id.to_i)
|
10
|
+
session = slot.open(PKCS11::CKF_RW_SESSION | PKCS11::CKF_SERIAL_SESSION)
|
11
|
+
|
12
|
+
if session.info.state == CKS_RW_USER_FUNCTIONS
|
13
|
+
raise "Session info state had CKS_RW_USER_FUNCTIONS when not logged in!"
|
14
|
+
end
|
15
|
+
|
16
|
+
session.close
|
17
|
+
pkcs11.close
|
18
|
+
|
19
|
+
pkcs11 = Luna::Library.new
|
20
|
+
pkcs11.set_application_id(10, 10)
|
21
|
+
slot = Luna::Slot.new(pkcs11, slot_id.to_i)
|
22
|
+
session = slot.open(PKCS11::CKF_RW_SESSION | PKCS11::CKF_SERIAL_SESSION)
|
23
|
+
if session.info.state != CKS_RW_USER_FUNCTIONS
|
24
|
+
raise "Session info state was not CKS_RW_USER_FUNCTIONS when application id set."
|
25
|
+
end
|
26
|
+
session.close
|
27
|
+
pkcs11.close
|
28
|
+
|
29
|
+
exit(true)
|
data/test/luna_helper.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
begin
|
2
|
+
require 'io/console'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
class LunaHelper
|
7
|
+
|
8
|
+
@@slot = nil
|
9
|
+
@@password = nil
|
10
|
+
|
11
|
+
def self.get_password(prompt)
|
12
|
+
password = ""
|
13
|
+
if STDIN.respond_to?(:echo=) and STDIN.respond_to?(:getch)
|
14
|
+
print prompt
|
15
|
+
STDIN.echo = false
|
16
|
+
while true
|
17
|
+
c = STDIN.getch
|
18
|
+
if c.ord == 3
|
19
|
+
STDIN.echo = true
|
20
|
+
exit!
|
21
|
+
end
|
22
|
+
if [10, 13].include?(c.ord)
|
23
|
+
print "\n"
|
24
|
+
break
|
25
|
+
end
|
26
|
+
if [8, 127].include?(c.ord)
|
27
|
+
if password.length >= 1
|
28
|
+
print 8.chr
|
29
|
+
print 32.chr
|
30
|
+
print 8.chr
|
31
|
+
password = password[0..-2]
|
32
|
+
end
|
33
|
+
else
|
34
|
+
password << c
|
35
|
+
print '*'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
STDIN.echo = true
|
39
|
+
else
|
40
|
+
password = `read -s -p "#{prompt}" password; echo $password`.chomp
|
41
|
+
end
|
42
|
+
password
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def self.get_slot_password()
|
47
|
+
if @@slot.nil?
|
48
|
+
print "Enter slot id: "
|
49
|
+
@@slot = gets
|
50
|
+
end
|
51
|
+
if @@password.nil?
|
52
|
+
@@password = get_password("Enter user PIN : ")
|
53
|
+
end
|
54
|
+
return @@slot.to_i, @@password
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|