nss: import at 3.0.1 beta 1
[mozilla-nss.git] / security / nss / cmd / pk11util / pk11table.c
blobc233fd80d05275d151eb70a29a4c1c7e6daaca0f
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
37 #include <pkcs11.h>
38 #include "pk11util.h"
40 const char *_valueString[] = {
41 "None",
42 "Variable",
43 "CK_ULONG",
44 "Data",
45 "UTF8",
46 "CK_INFO",
47 "CK_SLOT_INFO",
48 "CK_TOKEN_INFO",
49 "CK_SESSION_INFO",
50 "CK_ATTRIBUTE",
51 "CK_MECHANISM",
52 "CK_MECHANISM_INFO",
53 "CK_C_INITIALIZE_ARGS",
54 "CK_FUNCTION_LIST"
57 const char **valueString = &_valueString[0];
58 const int valueCount = sizeof(_valueString)/sizeof(_valueString[0]);
60 const char *_constTypeString[] = {
61 "None",
62 "Bool",
63 "InfoFlags",
64 "SlotFlags",
65 "TokenFlags",
66 "SessionFlags",
67 "MechanismFlags",
68 "InitializeFlags",
69 "Users",
70 "SessionState",
71 "Object",
72 "Hardware",
73 "KeyType",
74 "CertificateType",
75 "Attribute",
76 "Mechanism",
77 "Result",
78 "Trust",
79 "AvailableSizes",
80 "CurrentSize"
83 const char **constTypeString = &_constTypeString[0];
84 const int constTypeCount = sizeof(_constTypeString)/sizeof(_constTypeString[0]);
86 #define mkEntry(x,t) { #x, x, Const##t, ConstNone }
87 #define mkEntry2(x,t,t2) { #x, x, Const##t, Const##t2 }
89 const Constant _consts[] = {
90 mkEntry(CK_FALSE, Bool),
91 mkEntry(CK_TRUE, Bool),
93 mkEntry(CKF_TOKEN_PRESENT, SlotFlags),
94 mkEntry(CKF_REMOVABLE_DEVICE, SlotFlags),
95 mkEntry(CKF_HW_SLOT, SlotFlags),
97 mkEntry(CKF_RNG, TokenFlags),
98 mkEntry(CKF_WRITE_PROTECTED, TokenFlags),
99 mkEntry(CKF_LOGIN_REQUIRED, TokenFlags),
100 mkEntry(CKF_USER_PIN_INITIALIZED, TokenFlags),
101 mkEntry(CKF_RESTORE_KEY_NOT_NEEDED, TokenFlags),
102 mkEntry(CKF_CLOCK_ON_TOKEN, TokenFlags),
103 mkEntry(CKF_PROTECTED_AUTHENTICATION_PATH, TokenFlags),
104 mkEntry(CKF_DUAL_CRYPTO_OPERATIONS, TokenFlags),
105 mkEntry(CKF_TOKEN_INITIALIZED, TokenFlags),
106 mkEntry(CKF_SECONDARY_AUTHENTICATION, TokenFlags),
107 mkEntry(CKF_USER_PIN_COUNT_LOW, TokenFlags),
108 mkEntry(CKF_USER_PIN_FINAL_TRY, TokenFlags),
109 mkEntry(CKF_USER_PIN_LOCKED, TokenFlags),
110 mkEntry(CKF_USER_PIN_TO_BE_CHANGED, TokenFlags),
111 mkEntry(CKF_SO_PIN_COUNT_LOW, TokenFlags),
112 mkEntry(CKF_SO_PIN_FINAL_TRY, TokenFlags),
113 mkEntry(CKF_SO_PIN_LOCKED, TokenFlags),
114 mkEntry(CKF_SO_PIN_TO_BE_CHANGED, TokenFlags),
116 mkEntry(CKF_RW_SESSION, SessionFlags),
117 mkEntry(CKF_SERIAL_SESSION, SessionFlags),
119 mkEntry(CKF_HW, MechanismFlags),
120 mkEntry(CKF_ENCRYPT, MechanismFlags),
121 mkEntry(CKF_DECRYPT, MechanismFlags),
122 mkEntry(CKF_DIGEST, MechanismFlags),
123 mkEntry(CKF_SIGN, MechanismFlags),
124 mkEntry(CKF_SIGN_RECOVER, MechanismFlags),
125 mkEntry(CKF_VERIFY, MechanismFlags),
126 mkEntry(CKF_VERIFY_RECOVER, MechanismFlags),
127 mkEntry(CKF_GENERATE, MechanismFlags),
128 mkEntry(CKF_GENERATE_KEY_PAIR, MechanismFlags),
129 mkEntry(CKF_WRAP, MechanismFlags),
130 mkEntry(CKF_UNWRAP, MechanismFlags),
131 mkEntry(CKF_DERIVE, MechanismFlags),
132 mkEntry(CKF_EC_FP, MechanismFlags),
133 mkEntry(CKF_EC_F_2M, MechanismFlags),
134 mkEntry(CKF_EC_ECPARAMETERS, MechanismFlags),
135 mkEntry(CKF_EC_NAMEDCURVE, MechanismFlags),
136 mkEntry(CKF_EC_UNCOMPRESS, MechanismFlags),
137 mkEntry(CKF_EC_COMPRESS, MechanismFlags),
139 mkEntry(CKF_LIBRARY_CANT_CREATE_OS_THREADS, InitializeFlags),
140 mkEntry(CKF_OS_LOCKING_OK, InitializeFlags),
142 mkEntry(CKU_SO, Users),
143 mkEntry(CKU_USER, Users),
145 mkEntry(CKS_RO_PUBLIC_SESSION, SessionState),
146 mkEntry(CKS_RO_USER_FUNCTIONS, SessionState),
147 mkEntry(CKS_RW_PUBLIC_SESSION, SessionState),
148 mkEntry(CKS_RW_USER_FUNCTIONS, SessionState),
149 mkEntry(CKS_RW_SO_FUNCTIONS, SessionState),
151 mkEntry(CKO_DATA, Object),
152 mkEntry(CKO_CERTIFICATE, Object),
153 mkEntry(CKO_PUBLIC_KEY, Object),
154 mkEntry(CKO_PRIVATE_KEY, Object),
155 mkEntry(CKO_SECRET_KEY, Object),
156 mkEntry(CKO_HW_FEATURE, Object),
157 mkEntry(CKO_DOMAIN_PARAMETERS, Object),
158 mkEntry(CKO_KG_PARAMETERS, Object),
159 mkEntry(CKO_NETSCAPE_CRL, Object),
160 mkEntry(CKO_NETSCAPE_SMIME, Object),
161 mkEntry(CKO_NETSCAPE_TRUST, Object),
162 mkEntry(CKO_NETSCAPE_BUILTIN_ROOT_LIST, Object),
164 mkEntry(CKH_MONOTONIC_COUNTER, Hardware),
165 mkEntry(CKH_CLOCK, Hardware),
167 mkEntry(CKK_RSA, KeyType),
168 mkEntry(CKK_DSA, KeyType),
169 mkEntry(CKK_DH, KeyType),
170 mkEntry(CKK_ECDSA, KeyType),
171 mkEntry(CKK_EC, KeyType),
172 mkEntry(CKK_X9_42_DH, KeyType),
173 mkEntry(CKK_KEA, KeyType),
174 mkEntry(CKK_GENERIC_SECRET, KeyType),
175 mkEntry(CKK_RC2, KeyType),
176 mkEntry(CKK_RC4, KeyType),
177 mkEntry(CKK_DES, KeyType),
178 mkEntry(CKK_DES2, KeyType),
179 mkEntry(CKK_DES3, KeyType),
180 mkEntry(CKK_CAST, KeyType),
181 mkEntry(CKK_CAST3, KeyType),
182 mkEntry(CKK_CAST5, KeyType),
183 mkEntry(CKK_CAST128, KeyType),
184 mkEntry(CKK_RC5, KeyType),
185 mkEntry(CKK_IDEA, KeyType),
186 mkEntry(CKK_SKIPJACK, KeyType),
187 mkEntry(CKK_BATON, KeyType),
188 mkEntry(CKK_JUNIPER, KeyType),
189 mkEntry(CKK_CDMF, KeyType),
190 mkEntry(CKK_AES, KeyType),
191 mkEntry(CKK_CAMELLIA, KeyType),
192 mkEntry(CKK_NETSCAPE_PKCS8, KeyType),
194 mkEntry(CKC_X_509, CertType),
195 mkEntry(CKC_X_509_ATTR_CERT, CertType),
197 mkEntry2(CKA_CLASS, Attribute, Object),
198 mkEntry2(CKA_TOKEN, Attribute, Bool),
199 mkEntry2(CKA_PRIVATE, Attribute, Bool),
200 mkEntry2(CKA_LABEL, Attribute, None),
201 mkEntry2(CKA_APPLICATION, Attribute, None),
202 mkEntry2(CKA_VALUE, Attribute, None),
203 mkEntry2(CKA_OBJECT_ID, Attribute, None),
204 mkEntry2(CKA_CERTIFICATE_TYPE, Attribute, CertType),
205 mkEntry2(CKA_ISSUER, Attribute, None),
206 mkEntry2(CKA_SERIAL_NUMBER, Attribute, None),
207 mkEntry2(CKA_AC_ISSUER, Attribute, None),
208 mkEntry2(CKA_OWNER, Attribute, None),
209 mkEntry2(CKA_ATTR_TYPES, Attribute, None),
210 mkEntry2(CKA_TRUSTED, Attribute, Bool),
211 mkEntry2(CKA_KEY_TYPE, Attribute, KeyType),
212 mkEntry2(CKA_SUBJECT, Attribute, None),
213 mkEntry2(CKA_ID, Attribute, None),
214 mkEntry2(CKA_SENSITIVE, Attribute, Bool),
215 mkEntry2(CKA_ENCRYPT, Attribute, Bool),
216 mkEntry2(CKA_DECRYPT, Attribute, Bool),
217 mkEntry2(CKA_WRAP, Attribute, Bool),
218 mkEntry2(CKA_UNWRAP, Attribute, Bool),
219 mkEntry2(CKA_SIGN, Attribute, Bool),
220 mkEntry2(CKA_SIGN_RECOVER, Attribute, Bool),
221 mkEntry2(CKA_VERIFY, Attribute, Bool),
222 mkEntry2(CKA_VERIFY_RECOVER, Attribute, Bool),
223 mkEntry2(CKA_DERIVE, Attribute, Bool),
224 mkEntry2(CKA_START_DATE, Attribute, None),
225 mkEntry2(CKA_END_DATE, Attribute, None),
226 mkEntry2(CKA_MODULUS, Attribute, None),
227 mkEntry2(CKA_MODULUS_BITS, Attribute, None),
228 mkEntry2(CKA_PUBLIC_EXPONENT, Attribute, None),
229 mkEntry2(CKA_PRIVATE_EXPONENT, Attribute, None),
230 mkEntry2(CKA_PRIME_1, Attribute, None),
231 mkEntry2(CKA_PRIME_2, Attribute, None),
232 mkEntry2(CKA_EXPONENT_1, Attribute, None),
233 mkEntry2(CKA_EXPONENT_2, Attribute, None),
234 mkEntry2(CKA_COEFFICIENT, Attribute, None),
235 mkEntry2(CKA_PRIME, Attribute, None),
236 mkEntry2(CKA_SUBPRIME, Attribute, None),
237 mkEntry2(CKA_BASE, Attribute, None),
238 mkEntry2(CKA_PRIME_BITS, Attribute, None),
239 mkEntry2(CKA_SUB_PRIME_BITS, Attribute, None),
240 mkEntry2(CKA_VALUE_BITS, Attribute, None),
241 mkEntry2(CKA_VALUE_LEN, Attribute, None),
242 mkEntry2(CKA_EXTRACTABLE, Attribute, Bool),
243 mkEntry2(CKA_LOCAL, Attribute, Bool),
244 mkEntry2(CKA_NEVER_EXTRACTABLE, Attribute, Bool),
245 mkEntry2(CKA_ALWAYS_SENSITIVE, Attribute, Bool),
246 mkEntry2(CKA_KEY_GEN_MECHANISM, Attribute, Mechanism),
247 mkEntry2(CKA_MODIFIABLE, Attribute, Bool),
248 mkEntry2(CKA_ECDSA_PARAMS, Attribute, None),
249 mkEntry2(CKA_EC_PARAMS, Attribute, None),
250 mkEntry2(CKA_EC_POINT, Attribute, None),
251 mkEntry2(CKA_SECONDARY_AUTH, Attribute, None),
252 mkEntry2(CKA_AUTH_PIN_FLAGS, Attribute, None),
253 mkEntry2(CKA_HW_FEATURE_TYPE, Attribute, Hardware),
254 mkEntry2(CKA_RESET_ON_INIT, Attribute, Bool),
255 mkEntry2(CKA_HAS_RESET, Attribute, Bool),
256 mkEntry2(CKA_NETSCAPE_URL, Attribute, None),
257 mkEntry2(CKA_NETSCAPE_EMAIL, Attribute, None),
258 mkEntry2(CKA_NETSCAPE_SMIME_INFO, Attribute, None),
259 mkEntry2(CKA_NETSCAPE_SMIME_TIMESTAMP, Attribute, None),
260 mkEntry2(CKA_NETSCAPE_PKCS8_SALT, Attribute, None),
261 mkEntry2(CKA_NETSCAPE_PASSWORD_CHECK, Attribute, None),
262 mkEntry2(CKA_NETSCAPE_EXPIRES, Attribute, None),
263 mkEntry2(CKA_NETSCAPE_KRL, Attribute, None),
264 mkEntry2(CKA_NETSCAPE_PQG_COUNTER, Attribute, None),
265 mkEntry2(CKA_NETSCAPE_PQG_SEED, Attribute, None),
266 mkEntry2(CKA_NETSCAPE_PQG_H, Attribute, None),
267 mkEntry2(CKA_NETSCAPE_PQG_SEED_BITS, Attribute, None),
268 mkEntry2(CKA_TRUST_DIGITAL_SIGNATURE, Attribute, Trust),
269 mkEntry2(CKA_TRUST_NON_REPUDIATION, Attribute, Trust),
270 mkEntry2(CKA_TRUST_KEY_ENCIPHERMENT, Attribute, Trust),
271 mkEntry2(CKA_TRUST_DATA_ENCIPHERMENT, Attribute, Trust),
272 mkEntry2(CKA_TRUST_KEY_AGREEMENT, Attribute, Trust),
273 mkEntry2(CKA_TRUST_KEY_CERT_SIGN, Attribute, Trust),
274 mkEntry2(CKA_TRUST_CRL_SIGN, Attribute, Trust),
275 mkEntry2(CKA_TRUST_SERVER_AUTH, Attribute, Trust),
276 mkEntry2(CKA_TRUST_CLIENT_AUTH, Attribute, Trust),
277 mkEntry2(CKA_TRUST_CODE_SIGNING, Attribute, Trust),
278 mkEntry2(CKA_TRUST_EMAIL_PROTECTION, Attribute, Trust),
279 mkEntry2(CKA_TRUST_IPSEC_END_SYSTEM, Attribute, Trust),
280 mkEntry2(CKA_TRUST_IPSEC_TUNNEL, Attribute, Trust),
281 mkEntry2(CKA_TRUST_IPSEC_USER, Attribute, Trust),
282 mkEntry2(CKA_TRUST_TIME_STAMPING, Attribute, Trust),
283 mkEntry2(CKA_CERT_SHA1_HASH, Attribute, None),
284 mkEntry2(CKA_CERT_MD5_HASH, Attribute, None),
285 mkEntry2(CKA_NETSCAPE_DB, Attribute, None),
286 mkEntry2(CKA_NETSCAPE_TRUST, Attribute, Trust),
288 mkEntry(CKM_RSA_PKCS, Mechanism),
289 mkEntry(CKM_RSA_9796, Mechanism),
290 mkEntry(CKM_RSA_X_509, Mechanism),
291 mkEntry(CKM_RSA_PKCS_KEY_PAIR_GEN, Mechanism),
292 mkEntry(CKM_MD2_RSA_PKCS, Mechanism),
293 mkEntry(CKM_MD5_RSA_PKCS, Mechanism),
294 mkEntry(CKM_SHA1_RSA_PKCS, Mechanism),
295 mkEntry(CKM_RIPEMD128_RSA_PKCS, Mechanism),
296 mkEntry(CKM_RIPEMD160_RSA_PKCS, Mechanism),
297 mkEntry(CKM_RSA_PKCS_OAEP, Mechanism),
298 mkEntry(CKM_RSA_X9_31_KEY_PAIR_GEN, Mechanism),
299 mkEntry(CKM_RSA_X9_31, Mechanism),
300 mkEntry(CKM_SHA1_RSA_X9_31, Mechanism),
301 mkEntry(CKM_DSA_KEY_PAIR_GEN, Mechanism),
302 mkEntry(CKM_DSA, Mechanism),
303 mkEntry(CKM_DSA_SHA1, Mechanism),
304 mkEntry(CKM_DH_PKCS_KEY_PAIR_GEN, Mechanism),
305 mkEntry(CKM_DH_PKCS_DERIVE, Mechanism),
306 mkEntry(CKM_X9_42_DH_DERIVE, Mechanism),
307 mkEntry(CKM_X9_42_DH_HYBRID_DERIVE, Mechanism),
308 mkEntry(CKM_X9_42_MQV_DERIVE, Mechanism),
309 mkEntry(CKM_SHA256_RSA_PKCS, Mechanism),
310 mkEntry(CKM_SHA384_RSA_PKCS, Mechanism),
311 mkEntry(CKM_SHA512_RSA_PKCS, Mechanism),
312 mkEntry(CKM_RC2_KEY_GEN, Mechanism),
313 mkEntry(CKM_RC2_ECB, Mechanism),
314 mkEntry(CKM_RC2_CBC, Mechanism),
315 mkEntry(CKM_RC2_MAC, Mechanism),
316 mkEntry(CKM_RC2_MAC_GENERAL, Mechanism),
317 mkEntry(CKM_RC2_CBC_PAD, Mechanism),
318 mkEntry(CKM_RC4_KEY_GEN, Mechanism),
319 mkEntry(CKM_RC4, Mechanism),
320 mkEntry(CKM_DES_KEY_GEN, Mechanism),
321 mkEntry(CKM_DES_ECB, Mechanism),
322 mkEntry(CKM_DES_CBC, Mechanism),
323 mkEntry(CKM_DES_MAC, Mechanism),
324 mkEntry(CKM_DES_MAC_GENERAL, Mechanism),
325 mkEntry(CKM_DES_CBC_PAD, Mechanism),
326 mkEntry(CKM_DES2_KEY_GEN, Mechanism),
327 mkEntry(CKM_DES3_KEY_GEN, Mechanism),
328 mkEntry(CKM_DES3_ECB, Mechanism),
329 mkEntry(CKM_DES3_CBC, Mechanism),
330 mkEntry(CKM_DES3_MAC, Mechanism),
331 mkEntry(CKM_DES3_MAC_GENERAL, Mechanism),
332 mkEntry(CKM_DES3_CBC_PAD, Mechanism),
333 mkEntry(CKM_CDMF_KEY_GEN, Mechanism),
334 mkEntry(CKM_CDMF_ECB, Mechanism),
335 mkEntry(CKM_CDMF_CBC, Mechanism),
336 mkEntry(CKM_CDMF_MAC, Mechanism),
337 mkEntry(CKM_CDMF_MAC_GENERAL, Mechanism),
338 mkEntry(CKM_CDMF_CBC_PAD, Mechanism),
339 mkEntry(CKM_MD2, Mechanism),
340 mkEntry(CKM_MD2_HMAC, Mechanism),
341 mkEntry(CKM_MD2_HMAC_GENERAL, Mechanism),
342 mkEntry(CKM_MD5, Mechanism),
343 mkEntry(CKM_MD5_HMAC, Mechanism),
344 mkEntry(CKM_MD5_HMAC_GENERAL, Mechanism),
345 mkEntry(CKM_SHA_1, Mechanism),
346 mkEntry(CKM_SHA_1_HMAC, Mechanism),
347 mkEntry(CKM_SHA_1_HMAC_GENERAL, Mechanism),
348 mkEntry(CKM_RIPEMD128, Mechanism),
349 mkEntry(CKM_RIPEMD128_HMAC, Mechanism),
350 mkEntry(CKM_RIPEMD128_HMAC_GENERAL, Mechanism),
351 mkEntry(CKM_RIPEMD160, Mechanism),
352 mkEntry(CKM_RIPEMD160_HMAC, Mechanism),
353 mkEntry(CKM_RIPEMD160_HMAC_GENERAL, Mechanism),
354 mkEntry(CKM_SHA256, Mechanism),
355 mkEntry(CKM_SHA256_HMAC_GENERAL, Mechanism),
356 mkEntry(CKM_SHA256_HMAC, Mechanism),
357 mkEntry(CKM_SHA384, Mechanism),
358 mkEntry(CKM_SHA384_HMAC_GENERAL, Mechanism),
359 mkEntry(CKM_SHA384_HMAC, Mechanism),
360 mkEntry(CKM_SHA512, Mechanism),
361 mkEntry(CKM_SHA512_HMAC_GENERAL, Mechanism),
362 mkEntry(CKM_SHA512_HMAC, Mechanism),
363 mkEntry(CKM_CAST_KEY_GEN, Mechanism),
364 mkEntry(CKM_CAST_ECB, Mechanism),
365 mkEntry(CKM_CAST_CBC, Mechanism),
366 mkEntry(CKM_CAST_MAC, Mechanism),
367 mkEntry(CKM_CAST_MAC_GENERAL, Mechanism),
368 mkEntry(CKM_CAST_CBC_PAD, Mechanism),
369 mkEntry(CKM_CAST3_KEY_GEN, Mechanism),
370 mkEntry(CKM_CAST3_ECB, Mechanism),
371 mkEntry(CKM_CAST3_CBC, Mechanism),
372 mkEntry(CKM_CAST3_MAC, Mechanism),
373 mkEntry(CKM_CAST3_MAC_GENERAL, Mechanism),
374 mkEntry(CKM_CAST3_CBC_PAD, Mechanism),
375 mkEntry(CKM_CAST5_KEY_GEN, Mechanism),
376 mkEntry(CKM_CAST128_KEY_GEN, Mechanism),
377 mkEntry(CKM_CAST5_ECB, Mechanism),
378 mkEntry(CKM_CAST128_ECB, Mechanism),
379 mkEntry(CKM_CAST5_CBC, Mechanism),
380 mkEntry(CKM_CAST128_CBC, Mechanism),
381 mkEntry(CKM_CAST5_MAC, Mechanism),
382 mkEntry(CKM_CAST128_MAC, Mechanism),
383 mkEntry(CKM_CAST5_MAC_GENERAL, Mechanism),
384 mkEntry(CKM_CAST128_MAC_GENERAL, Mechanism),
385 mkEntry(CKM_CAST5_CBC_PAD, Mechanism),
386 mkEntry(CKM_CAST128_CBC_PAD, Mechanism),
387 mkEntry(CKM_RC5_KEY_GEN, Mechanism),
388 mkEntry(CKM_RC5_ECB, Mechanism),
389 mkEntry(CKM_RC5_CBC, Mechanism),
390 mkEntry(CKM_RC5_MAC, Mechanism),
391 mkEntry(CKM_RC5_MAC_GENERAL, Mechanism),
392 mkEntry(CKM_RC5_CBC_PAD, Mechanism),
393 mkEntry(CKM_IDEA_KEY_GEN, Mechanism),
394 mkEntry(CKM_IDEA_ECB, Mechanism),
395 mkEntry(CKM_IDEA_CBC, Mechanism),
396 mkEntry(CKM_IDEA_MAC, Mechanism),
397 mkEntry(CKM_IDEA_MAC_GENERAL, Mechanism),
398 mkEntry(CKM_IDEA_CBC_PAD, Mechanism),
399 mkEntry(CKM_GENERIC_SECRET_KEY_GEN, Mechanism),
400 mkEntry(CKM_CONCATENATE_BASE_AND_KEY, Mechanism),
401 mkEntry(CKM_CONCATENATE_BASE_AND_DATA, Mechanism),
402 mkEntry(CKM_CONCATENATE_DATA_AND_BASE, Mechanism),
403 mkEntry(CKM_XOR_BASE_AND_DATA, Mechanism),
404 mkEntry(CKM_EXTRACT_KEY_FROM_KEY, Mechanism),
405 mkEntry(CKM_SSL3_PRE_MASTER_KEY_GEN, Mechanism),
406 mkEntry(CKM_SSL3_MASTER_KEY_DERIVE, Mechanism),
407 mkEntry(CKM_SSL3_KEY_AND_MAC_DERIVE, Mechanism),
408 mkEntry(CKM_SSL3_MASTER_KEY_DERIVE_DH, Mechanism),
409 mkEntry(CKM_TLS_PRE_MASTER_KEY_GEN, Mechanism),
410 mkEntry(CKM_TLS_MASTER_KEY_DERIVE, Mechanism),
411 mkEntry(CKM_TLS_KEY_AND_MAC_DERIVE, Mechanism),
412 mkEntry(CKM_TLS_MASTER_KEY_DERIVE_DH, Mechanism),
413 mkEntry(CKM_SSL3_MD5_MAC, Mechanism),
414 mkEntry(CKM_SSL3_SHA1_MAC, Mechanism),
415 mkEntry(CKM_MD5_KEY_DERIVATION, Mechanism),
416 mkEntry(CKM_MD2_KEY_DERIVATION, Mechanism),
417 mkEntry(CKM_SHA1_KEY_DERIVATION, Mechanism),
418 mkEntry(CKM_SHA256_KEY_DERIVATION, Mechanism),
419 mkEntry(CKM_SHA384_KEY_DERIVATION, Mechanism),
420 mkEntry(CKM_SHA512_KEY_DERIVATION, Mechanism),
421 mkEntry(CKM_PBE_MD2_DES_CBC, Mechanism),
422 mkEntry(CKM_PBE_MD5_DES_CBC, Mechanism),
423 mkEntry(CKM_PBE_MD5_CAST_CBC, Mechanism),
424 mkEntry(CKM_PBE_MD5_CAST3_CBC, Mechanism),
425 mkEntry(CKM_PBE_MD5_CAST5_CBC, Mechanism),
426 mkEntry(CKM_PBE_MD5_CAST128_CBC, Mechanism),
427 mkEntry(CKM_PBE_SHA1_CAST5_CBC, Mechanism),
428 mkEntry(CKM_PBE_SHA1_CAST128_CBC, Mechanism),
429 mkEntry(CKM_PBE_SHA1_RC4_128, Mechanism),
430 mkEntry(CKM_PBE_SHA1_RC4_40, Mechanism),
431 mkEntry(CKM_PBE_SHA1_DES3_EDE_CBC, Mechanism),
432 mkEntry(CKM_PBE_SHA1_DES2_EDE_CBC, Mechanism),
433 mkEntry(CKM_PBE_SHA1_RC2_128_CBC, Mechanism),
434 mkEntry(CKM_PBE_SHA1_RC2_40_CBC, Mechanism),
435 mkEntry(CKM_PKCS5_PBKD2, Mechanism),
436 mkEntry(CKM_PBA_SHA1_WITH_SHA1_HMAC, Mechanism),
437 mkEntry(CKM_KEY_WRAP_LYNKS, Mechanism),
438 mkEntry(CKM_KEY_WRAP_SET_OAEP, Mechanism),
439 mkEntry(CKM_SKIPJACK_KEY_GEN, Mechanism),
440 mkEntry(CKM_SKIPJACK_ECB64, Mechanism),
441 mkEntry(CKM_SKIPJACK_CBC64, Mechanism),
442 mkEntry(CKM_SKIPJACK_OFB64, Mechanism),
443 mkEntry(CKM_SKIPJACK_CFB64, Mechanism),
444 mkEntry(CKM_SKIPJACK_CFB32, Mechanism),
445 mkEntry(CKM_SKIPJACK_CFB16, Mechanism),
446 mkEntry(CKM_SKIPJACK_CFB8, Mechanism),
447 mkEntry(CKM_SKIPJACK_WRAP, Mechanism),
448 mkEntry(CKM_SKIPJACK_PRIVATE_WRAP, Mechanism),
449 mkEntry(CKM_SKIPJACK_RELAYX, Mechanism),
450 mkEntry(CKM_KEA_KEY_PAIR_GEN, Mechanism),
451 mkEntry(CKM_KEA_KEY_DERIVE, Mechanism),
452 mkEntry(CKM_FORTEZZA_TIMESTAMP, Mechanism),
453 mkEntry(CKM_BATON_KEY_GEN, Mechanism),
454 mkEntry(CKM_BATON_ECB128, Mechanism),
455 mkEntry(CKM_BATON_ECB96, Mechanism),
456 mkEntry(CKM_BATON_CBC128, Mechanism),
457 mkEntry(CKM_BATON_COUNTER, Mechanism),
458 mkEntry(CKM_BATON_SHUFFLE, Mechanism),
459 mkEntry(CKM_BATON_WRAP, Mechanism),
460 mkEntry(CKM_ECDSA_KEY_PAIR_GEN, Mechanism),
461 mkEntry(CKM_EC_KEY_PAIR_GEN, Mechanism),
462 mkEntry(CKM_ECDSA, Mechanism),
463 mkEntry(CKM_ECDSA_SHA1, Mechanism),
464 mkEntry(CKM_ECDH1_DERIVE, Mechanism),
465 mkEntry(CKM_ECDH1_COFACTOR_DERIVE, Mechanism),
466 mkEntry(CKM_ECMQV_DERIVE, Mechanism),
467 mkEntry(CKM_JUNIPER_KEY_GEN, Mechanism),
468 mkEntry(CKM_JUNIPER_ECB128, Mechanism),
469 mkEntry(CKM_JUNIPER_CBC128, Mechanism),
470 mkEntry(CKM_JUNIPER_COUNTER, Mechanism),
471 mkEntry(CKM_JUNIPER_SHUFFLE, Mechanism),
472 mkEntry(CKM_JUNIPER_WRAP, Mechanism),
473 mkEntry(CKM_FASTHASH, Mechanism),
474 mkEntry(CKM_AES_KEY_GEN, Mechanism),
475 mkEntry(CKM_AES_ECB, Mechanism),
476 mkEntry(CKM_AES_CBC, Mechanism),
477 mkEntry(CKM_AES_MAC, Mechanism),
478 mkEntry(CKM_AES_MAC_GENERAL, Mechanism),
479 mkEntry(CKM_AES_CBC_PAD, Mechanism),
480 mkEntry(CKM_CAMELLIA_KEY_GEN, Mechanism),
481 mkEntry(CKM_CAMELLIA_ECB, Mechanism),
482 mkEntry(CKM_CAMELLIA_CBC, Mechanism),
483 mkEntry(CKM_CAMELLIA_MAC, Mechanism),
484 mkEntry(CKM_CAMELLIA_MAC_GENERAL, Mechanism),
485 mkEntry(CKM_CAMELLIA_CBC_PAD, Mechanism),
486 mkEntry(CKM_DSA_PARAMETER_GEN, Mechanism),
487 mkEntry(CKM_DH_PKCS_PARAMETER_GEN, Mechanism),
488 mkEntry(CKM_NETSCAPE_AES_KEY_WRAP, Mechanism),
489 mkEntry(CKM_NETSCAPE_AES_KEY_WRAP_PAD, Mechanism),
490 mkEntry(CKM_NETSCAPE_PBE_SHA1_DES_CBC, Mechanism),
491 mkEntry(CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC, Mechanism),
492 mkEntry(CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC, Mechanism),
493 mkEntry(CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC, Mechanism),
494 mkEntry(CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4, Mechanism),
495 mkEntry(CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4, Mechanism),
496 mkEntry(CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC, Mechanism),
497 mkEntry(CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN, Mechanism),
498 mkEntry(CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN, Mechanism),
499 mkEntry(CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN, Mechanism),
500 mkEntry(CKM_TLS_PRF_GENERAL, Mechanism),
502 mkEntry(CKR_OK, Result),
503 mkEntry(CKR_CANCEL, Result),
504 mkEntry(CKR_HOST_MEMORY, Result),
505 mkEntry(CKR_SLOT_ID_INVALID, Result),
506 mkEntry(CKR_GENERAL_ERROR, Result),
507 mkEntry(CKR_FUNCTION_FAILED, Result),
508 mkEntry(CKR_ARGUMENTS_BAD, Result),
509 mkEntry(CKR_NO_EVENT, Result),
510 mkEntry(CKR_NEED_TO_CREATE_THREADS, Result),
511 mkEntry(CKR_CANT_LOCK, Result),
512 mkEntry(CKR_ATTRIBUTE_READ_ONLY, Result),
513 mkEntry(CKR_ATTRIBUTE_SENSITIVE, Result),
514 mkEntry(CKR_ATTRIBUTE_TYPE_INVALID, Result),
515 mkEntry(CKR_ATTRIBUTE_VALUE_INVALID, Result),
516 mkEntry(CKR_DATA_INVALID, Result),
517 mkEntry(CKR_DATA_LEN_RANGE, Result),
518 mkEntry(CKR_DEVICE_ERROR, Result),
519 mkEntry(CKR_DEVICE_MEMORY, Result),
520 mkEntry(CKR_DEVICE_REMOVED, Result),
521 mkEntry(CKR_ENCRYPTED_DATA_INVALID, Result),
522 mkEntry(CKR_ENCRYPTED_DATA_LEN_RANGE, Result),
523 mkEntry(CKR_FUNCTION_CANCELED, Result),
524 mkEntry(CKR_FUNCTION_NOT_PARALLEL, Result),
525 mkEntry(CKR_FUNCTION_NOT_SUPPORTED, Result),
526 mkEntry(CKR_KEY_HANDLE_INVALID, Result),
527 mkEntry(CKR_KEY_SIZE_RANGE, Result),
528 mkEntry(CKR_KEY_TYPE_INCONSISTENT, Result),
529 mkEntry(CKR_KEY_NOT_NEEDED, Result),
530 mkEntry(CKR_KEY_CHANGED, Result),
531 mkEntry(CKR_KEY_NEEDED, Result),
532 mkEntry(CKR_KEY_INDIGESTIBLE, Result),
533 mkEntry(CKR_KEY_FUNCTION_NOT_PERMITTED, Result),
534 mkEntry(CKR_KEY_NOT_WRAPPABLE, Result),
535 mkEntry(CKR_KEY_UNEXTRACTABLE, Result),
536 mkEntry(CKR_KEY_PARAMS_INVALID, Result),
537 mkEntry(CKR_MECHANISM_INVALID, Result),
538 mkEntry(CKR_MECHANISM_PARAM_INVALID, Result),
539 mkEntry(CKR_OBJECT_HANDLE_INVALID, Result),
540 mkEntry(CKR_OPERATION_ACTIVE, Result),
541 mkEntry(CKR_OPERATION_NOT_INITIALIZED, Result),
542 mkEntry(CKR_PIN_INCORRECT, Result),
543 mkEntry(CKR_PIN_INVALID, Result),
544 mkEntry(CKR_PIN_LEN_RANGE, Result),
545 mkEntry(CKR_PIN_EXPIRED, Result),
546 mkEntry(CKR_PIN_LOCKED, Result),
547 mkEntry(CKR_SESSION_CLOSED, Result),
548 mkEntry(CKR_SESSION_COUNT, Result),
549 mkEntry(CKR_SESSION_HANDLE_INVALID, Result),
550 mkEntry(CKR_SESSION_PARALLEL_NOT_SUPPORTED, Result),
551 mkEntry(CKR_SESSION_READ_ONLY, Result),
552 mkEntry(CKR_SESSION_EXISTS, Result),
553 mkEntry(CKR_SESSION_READ_ONLY_EXISTS, Result),
554 mkEntry(CKR_SESSION_READ_WRITE_SO_EXISTS, Result),
555 mkEntry(CKR_SIGNATURE_INVALID, Result),
556 mkEntry(CKR_SIGNATURE_LEN_RANGE, Result),
557 mkEntry(CKR_TEMPLATE_INCOMPLETE, Result),
558 mkEntry(CKR_TEMPLATE_INCONSISTENT, Result),
559 mkEntry(CKR_TOKEN_NOT_PRESENT, Result),
560 mkEntry(CKR_TOKEN_NOT_RECOGNIZED, Result),
561 mkEntry(CKR_TOKEN_WRITE_PROTECTED, Result),
562 mkEntry(CKR_UNWRAPPING_KEY_HANDLE_INVALID, Result),
563 mkEntry(CKR_UNWRAPPING_KEY_SIZE_RANGE, Result),
564 mkEntry(CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT, Result),
565 mkEntry(CKR_USER_ALREADY_LOGGED_IN, Result),
566 mkEntry(CKR_USER_NOT_LOGGED_IN, Result),
567 mkEntry(CKR_USER_PIN_NOT_INITIALIZED, Result),
568 mkEntry(CKR_USER_TYPE_INVALID, Result),
569 mkEntry(CKR_USER_ANOTHER_ALREADY_LOGGED_IN, Result),
570 mkEntry(CKR_USER_TOO_MANY_TYPES, Result),
571 mkEntry(CKR_WRAPPED_KEY_INVALID, Result),
572 mkEntry(CKR_WRAPPED_KEY_LEN_RANGE, Result),
573 mkEntry(CKR_WRAPPING_KEY_HANDLE_INVALID, Result),
574 mkEntry(CKR_WRAPPING_KEY_SIZE_RANGE, Result),
575 mkEntry(CKR_WRAPPING_KEY_TYPE_INCONSISTENT, Result),
576 mkEntry(CKR_RANDOM_SEED_NOT_SUPPORTED, Result),
577 mkEntry(CKR_RANDOM_NO_RNG, Result),
578 mkEntry(CKR_DOMAIN_PARAMS_INVALID, Result),
579 mkEntry(CKR_BUFFER_TOO_SMALL, Result),
580 mkEntry(CKR_SAVED_STATE_INVALID, Result),
581 mkEntry(CKR_INFORMATION_SENSITIVE, Result),
582 mkEntry(CKR_STATE_UNSAVEABLE, Result),
583 mkEntry(CKR_CRYPTOKI_NOT_INITIALIZED, Result),
584 mkEntry(CKR_CRYPTOKI_ALREADY_INITIALIZED, Result),
585 mkEntry(CKR_MUTEX_BAD, Result),
586 mkEntry(CKR_MUTEX_NOT_LOCKED, Result),
587 mkEntry(CKR_VENDOR_DEFINED, Result),
589 mkEntry(CKT_NETSCAPE_TRUSTED, Trust),
590 mkEntry(CKT_NETSCAPE_TRUSTED_DELEGATOR, Trust),
591 mkEntry(CKT_NETSCAPE_UNTRUSTED, Trust),
592 mkEntry(CKT_NETSCAPE_MUST_VERIFY, Trust),
593 mkEntry(CKT_NETSCAPE_TRUST_UNKNOWN, Trust),
594 mkEntry(CKT_NETSCAPE_VALID, Trust),
595 mkEntry(CKT_NETSCAPE_VALID_DELEGATOR, Trust),
597 mkEntry(CK_EFFECTIVELY_INFINITE, AvailableSizes),
598 mkEntry(CK_UNAVAILABLE_INFORMATION, CurrentSize),
601 const Constant *consts = &_consts[0];
602 const int constCount = sizeof(_consts)/sizeof(_consts[0]);
604 const Commands _commands[] = {
605 {"C_Initialize", F_C_Initialize,
606 "C_Initialize pInitArgs\n\n"
607 "C_Initialize initializes the PKCS #11 library.\n"
608 " pInitArgs if this is not NULL_PTR it gets cast to and dereferenced\n",
609 {ArgInitializeArgs, ArgNone, ArgNone, ArgNone, ArgNone,
610 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
611 {"C_Finalize", F_C_Finalize,
612 "C_Finalize pReserved\n\n"
613 "C_Finalize indicates that an application is done with the PKCS #11 library.\n"
614 " pReserved reserved. Should be NULL_PTR\n",
615 {ArgInitializeArgs, ArgNone, ArgNone, ArgNone, ArgNone,
616 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
617 {"C_GetInfo", F_C_GetInfo,
618 "C_GetInfo pInfo\n\n"
619 "C_GetInfo returns general information about PKCS #11.\n"
620 " pInfo location that receives information\n",
621 {ArgInfo|ArgOut, ArgNone, ArgNone, ArgNone, ArgNone,
622 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
623 {"C_GetFunctionList", F_C_GetFunctionList,
624 "C_GetFunctionList ppFunctionList\n\n"
625 "C_GetFunctionList returns the function list.\n"
626 " ppFunctionList receives pointer to function list\n",
627 {ArgFunctionList|ArgOut, ArgNone, ArgNone, ArgNone, ArgNone,
628 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
629 {"C_GetSlotList", F_C_GetSlotList,
630 "C_GetSlotList tokenPresent pSlotList pulCount\n\n"
631 "C_GetSlotList obtains a list of slots in the system.\n"
632 " tokenPresent only slots with tokens?\n"
633 " pSlotList receives array of slot IDs\n"
634 " pulCount receives number of slots\n",
635 {ArgULong, ArgULong|ArgArray|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
636 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
637 {"C_GetSlotInfo", F_C_GetSlotInfo,
638 "C_GetSlotInfo slotID pInfo\n\n"
639 "C_GetSlotInfo obtains information about a particular slot in the system.\n"
640 " slotID the ID of the slot\n"
641 " pInfo receives the slot information\n",
642 {ArgULong, ArgSlotInfo|ArgOut, ArgNone, ArgNone, ArgNone,
643 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
644 {"C_GetTokenInfo", F_C_GetTokenInfo,
645 "C_GetTokenInfo slotID pInfo\n\n"
646 "C_GetTokenInfo obtains information about a particular token in the system.\n"
647 " slotID ID of the token's slot\n"
648 " pInfo receives the token information\n",
649 {ArgULong, ArgTokenInfo|ArgOut, ArgNone, ArgNone, ArgNone,
650 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
651 {"C_GetMechanismList", F_C_GetMechanismList,
652 "C_GetMechanismList slotID pMechanismList pulCount\n\n"
653 "C_GetMechanismList obtains a list of mechanism types supported by a token.\n"
654 " slotID ID of token's slot\n"
655 " pMechanismList gets mech. array\n"
656 " pulCount gets # of mechs.\n",
657 {ArgULong, ArgULong|ArgArray|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
658 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
659 {"C_GetMechanismInfo", F_C_GetMechanismInfo,
660 "C_GetMechanismInfo slotID type pInfo\n\n"
661 "C_GetMechanismInfo obtains information about a particular mechanism possibly\n"
662 "supported by a token.\n"
663 " slotID ID of the token's slot\n"
664 " type type of mechanism\n"
665 " pInfo receives mechanism info\n",
666 {ArgULong, ArgULong, ArgMechanismInfo|ArgOut, ArgNone, ArgNone,
667 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
668 {"C_InitToken", F_C_InitToken,
669 "C_InitToken slotID pPin ulPinLen pLabel\n\n"
670 "C_InitToken initializes a token.\n"
671 " slotID ID of the token's slot\n"
672 " pPin the SO's initial PIN\n"
673 " ulPinLen length in bytes of the PIN\n"
674 " pLabel 32-byte token label (blank padded)\n",
675 {ArgULong, ArgUTF8, ArgULong, ArgUTF8, ArgNone,
676 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
677 {"C_InitPIN", F_C_InitPIN,
678 "C_InitPIN hSession pPin ulPinLen\n\n"
679 "C_InitPIN initializes the normal user's PIN.\n"
680 " hSession the session's handle\n"
681 " pPin the normal user's PIN\n"
682 " ulPinLen length in bytes of the PIN\n",
683 {ArgULong, ArgUTF8, ArgULong, ArgNone, ArgNone,
684 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
685 {"C_SetPIN", F_C_SetPIN,
686 "C_SetPIN hSession pOldPin ulOldLen pNewPin ulNewLen\n\n"
687 "C_SetPIN modifies the PIN of the user who is logged in.\n"
688 " hSession the session's handle\n"
689 " pOldPin the old PIN\n"
690 " ulOldLen length of the old PIN\n"
691 " pNewPin the new PIN\n"
692 " ulNewLen length of the new PIN\n",
693 {ArgULong, ArgUTF8, ArgULong, ArgUTF8, ArgULong,
694 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
695 {"C_OpenSession", F_C_OpenSession,
696 "C_OpenSession slotID flags phSession\n\n"
697 "C_OpenSession opens a session between an application and a token.\n"
698 " slotID the slot's ID\n"
699 " flags from\n"
700 " phSession gets session handle\n",
701 {ArgULong, ArgULong, ArgULong|ArgOut, ArgNone, ArgNone,
702 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
703 {"C_CloseSession", F_C_CloseSession,
704 "C_CloseSession hSession\n\n"
705 "C_CloseSession closes a session between an application and a token.\n"
706 " hSession the session's handle\n",
707 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
708 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
709 {"C_CloseAllSessions", F_C_CloseAllSessions,
710 "C_CloseAllSessions slotID\n\n"
711 "C_CloseAllSessions closes all sessions with a token.\n"
712 " slotID the token's slot\n",
713 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
714 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
715 {"C_GetSessionInfo", F_C_GetSessionInfo,
716 "C_GetSessionInfo hSession pInfo\n\n"
717 "C_GetSessionInfo obtains information about the session.\n"
718 " hSession the session's handle\n"
719 " pInfo receives session info\n",
720 {ArgULong, ArgSessionInfo|ArgOut, ArgNone, ArgNone, ArgNone,
721 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
722 {"C_GetOperationState", F_C_GetOperationState,
723 "C_GetOperationState hSession pOpState pulOpStateLen\n\n"
724 "C_GetOperationState obtains the state of the cryptographic operation in a\n"
725 "session.\n"
726 " hSession session's handle\n"
727 " pOpState gets state\n"
728 " pulOpStateLen gets state length\n",
729 {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
730 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
731 {"C_SetOperationState", F_C_SetOperationState,
732 "C_SetOperationState hSession pOpState ulOpStateLen hEncKey hAuthKey\n\n"
733 "C_SetOperationState restores the state of the cryptographic operation in a\n"
734 "session.\n"
735 " hSession session's handle\n"
736 " pOpState holds state\n"
737 " ulOpStateLen holds state length\n"
738 " hEncKey en/decryption key\n"
739 " hAuthnKey sign/verify key\n",
740 {ArgULong, ArgChar|ArgOut, ArgULong, ArgULong, ArgULong,
741 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
742 {"C_Login", F_C_Login,
743 "C_Login hSession userType pPin ulPinLen\n\n"
744 "C_Login logs a user into a token.\n"
745 " hSession the session's handle\n"
746 " userType the user type\n"
747 " pPin the user's PIN\n"
748 " ulPinLen the length of the PIN\n",
749 {ArgULong, ArgULong, ArgVar, ArgULong, ArgNone,
750 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
751 {"C_Logout", F_C_Logout,
752 "C_Logout hSession\n\n"
753 "C_Logout logs a user out from a token.\n"
754 " hSession the session's handle\n",
755 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
756 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
757 {"C_CreateObject", F_C_CreateObject,
758 "C_CreateObject hSession pTemplate ulCount phObject\n\n"
759 "C_CreateObject creates a new object.\n"
760 " hSession the session's handle\n"
761 " pTemplate the object's template\n"
762 " ulCount attributes in template\n"
763 " phObject gets new object's handle.\n",
764 {ArgULong, ArgAttribute|ArgArray, ArgULong, ArgULong|ArgOut, ArgNone,
765 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
766 {"C_CopyObject", F_C_CopyObject,
767 "C_CopyObject hSession hObject pTemplate ulCount phNewObject\n\n"
768 "C_CopyObject copies an object creating a new object for the copy.\n"
769 " hSession the session's handle\n"
770 " hObject the object's handle\n"
771 " pTemplate template for new object\n"
772 " ulCount attributes in template\n"
773 " phNewObject receives handle of copy\n",
774 {ArgULong, ArgULong, ArgAttribute|ArgArray, ArgULong, ArgULong|ArgOut,
775 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
776 {"C_DestroyObject", F_C_DestroyObject,
777 "C_DestroyObject hSession hObject\n\n"
778 "C_DestroyObject destroys an object.\n"
779 " hSession the session's handle\n"
780 " hObject the object's handle\n",
781 {ArgULong, ArgULong, ArgNone, ArgNone, ArgNone,
782 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
783 {"C_GetObjectSize", F_C_GetObjectSize,
784 "C_GetObjectSize hSession hObject pulSize\n\n"
785 "C_GetObjectSize gets the size of an object in bytes.\n"
786 " hSession the session's handle\n"
787 " hObject the object's handle\n"
788 " pulSize receives size of object\n",
789 {ArgULong, ArgULong, ArgULong|ArgOut, ArgNone, ArgNone,
790 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
791 {"C_GetAttributeValue", F_C_GetAttributeValue,
792 "C_GetAttributeValue hSession hObject pTemplate ulCount\n\n"
793 "C_GetAttributeValue obtains the value of one or more object attributes.\n"
794 " hSession the session's handle\n"
795 " hObject the object's handle\n"
796 " pTemplate specifies attrs; gets vals\n"
797 " ulCount attributes in template\n",
798 {ArgULong, ArgULong, ArgAttribute|ArgArray, ArgULong, ArgNone,
799 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
800 {"C_SetAttributeValue", F_C_SetAttributeValue,
801 "C_SetAttributeValue hSession hObject pTemplate ulCount\n\n"
802 "C_SetAttributeValue modifies the value of one or more object attributes\n"
803 " hSession the session's handle\n"
804 " hObject the object's handle\n"
805 " pTemplate specifies attrs and values\n"
806 " ulCount attributes in template\n",
807 {ArgULong, ArgULong, ArgAttribute|ArgArray, ArgULong, ArgNone,
808 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
809 {"C_FindObjectsInit", F_C_FindObjectsInit,
810 "C_FindObjectsInit hSession pTemplate ulCount\n\n"
811 "C_FindObjectsInit initializes a search for token and session objects that\n"
812 "match a template.\n"
813 " hSession the session's handle\n"
814 " pTemplate attribute values to match\n"
815 " ulCount attrs in search template\n",
816 {ArgULong, ArgAttribute|ArgArray, ArgULong, ArgNone, ArgNone,
817 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
818 {"C_FindObjectsFinal", F_C_FindObjectsFinal,
819 "C_FindObjectsFinal hSession\n\n"
820 "C_FindObjectsFinal finishes a search for token and session objects.\n"
821 " hSession the session's handle\n",
822 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
823 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
824 {"C_FindObjects", F_C_FindObjects,
825 "C_FindObjects hSession phObject ulMaxObjectCount pulObjectCount\n\n"
826 "C_FindObjects continues a search for token and session objects that match\n"
827 "a template obtaining additional object handles.\n"
828 " hSession session's handle\n"
829 " phObject gets obj. handles\n"
830 " ulMaxObjectCount max handles to get\n"
831 " pulObjectCount actual # returned\n",
832 {ArgULong, ArgULong|ArgOut, ArgULong, ArgULong|ArgOut, ArgNone,
833 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
834 {"C_EncryptInit", F_C_EncryptInit,
835 "C_EncryptInit hSession pMechanism hKey\n\n"
836 "C_EncryptInit initializes an encryption operation.\n"
837 " hSession the session's handle\n"
838 " pMechanism the encryption mechanism\n"
839 " hKey handle of encryption key\n",
840 {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
841 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
842 {"C_EncryptUpdate", F_C_EncryptUpdate,
843 "C_EncryptUpdate hSession pPart ulPartLen pEncryptedPart pulEncryptedPartLen\n"
844 "\n"
845 "C_EncryptUpdate continues a multiple-part encryption operation.\n"
846 " hSession session's handle\n"
847 " pPart the plaintext data\n"
848 " ulPartLen plaintext data len\n"
849 " pEncryptedPart gets ciphertext\n"
850 " pulEncryptedPartLen gets c-text size\n",
851 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
852 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
853 {"C_EncryptFinal", F_C_EncryptFinal,
854 "C_EncryptFinal hSession pLastEncryptedPart pulLastEncryptedPartLen\n\n"
855 "C_EncryptFinal finishes a multiple-part encryption operation.\n"
856 " hSession session handle\n"
857 " pLastEncryptedPart last c-text\n"
858 " pulLastEncryptedPartLen gets last size\n",
859 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
860 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
861 {"C_Encrypt", F_C_Encrypt,
862 "C_Encrypt hSession pData ulDataLen pEncryptedData pulEncryptedDataLen\n\n"
863 "C_Encrypt encrypts single-part data.\n"
864 " hSession session's handle\n"
865 " pData the plaintext data\n"
866 " ulDataLen bytes of plaintext\n"
867 " pEncryptedData gets ciphertext\n"
868 " pulEncryptedDataLen gets c-text size\n",
869 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
870 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
871 {"C_DecryptInit", F_C_DecryptInit,
872 "C_DecryptInit hSession pMechanism hKey\n\n"
873 "C_DecryptInit initializes a decryption operation.\n"
874 " hSession the session's handle\n"
875 " pMechanism the decryption mechanism\n"
876 " hKey handle of decryption key\n",
877 {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
878 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
879 {"C_DecryptUpdate", F_C_DecryptUpdate,
880 "C_DecryptUpdate hSession pEncryptedPart ulEncryptedPartLen pPart pulPartLen\n"
881 "\n"
882 "C_DecryptUpdate continues a multiple-part decryption operation.\n"
883 " hSession session's handle\n"
884 " pEncryptedPart encrypted data\n"
885 " ulEncryptedPartLen input length\n"
886 " pPart gets plaintext\n"
887 " pulPartLen p-text size\n",
888 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
889 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
890 {"C_DecryptFinal", F_C_DecryptFinal,
891 "C_DecryptFinal hSession pLastPart pulLastPartLen\n\n"
892 "C_DecryptFinal finishes a multiple-part decryption operation.\n"
893 " hSession the session's handle\n"
894 " pLastPart gets plaintext\n"
895 " pulLastPartLen p-text size\n",
896 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
897 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
898 {"C_Decrypt", F_C_Decrypt,
899 "C_Decrypt hSession pEncryptedData ulEncryptedDataLen pData pulDataLen\n\n"
900 "C_Decrypt decrypts encrypted data in a single part.\n"
901 " hSession session's handle\n"
902 " pEncryptedData ciphertext\n"
903 " ulEncryptedDataLen ciphertext length\n"
904 " pData gets plaintext\n"
905 " pulDataLen gets p-text size\n",
906 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
907 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
908 {"C_DigestInit", F_C_DigestInit,
909 "C_DigestInit hSession pMechanism\n\n"
910 "C_DigestInit initializes a message-digesting operation.\n"
911 " hSession the session's handle\n"
912 " pMechanism the digesting mechanism\n",
913 {ArgULong, ArgMechanism, ArgNone, ArgNone, ArgNone,
914 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
915 {"C_DigestUpdate", F_C_DigestUpdate,
916 "C_DigestUpdate hSession pPart ulPartLen\n\n"
917 "C_DigestUpdate continues a multiple-part message-digesting operation.\n"
918 " hSession the session's handle\n"
919 " pPart data to be digested\n"
920 " ulPartLen bytes of data to be digested\n",
921 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
922 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
923 {"C_DigestKey", F_C_DigestKey,
924 "C_DigestKey hSession hKey\n\n"
925 "C_DigestKey continues a multi-part message-digesting operation by digesting\n"
926 "the value of a secret key as part of the data already digested.\n"
927 " hSession the session's handle\n"
928 " hKey secret key to digest\n",
929 {ArgULong, ArgULong, ArgNone, ArgNone, ArgNone,
930 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
931 {"C_DigestFinal", F_C_DigestFinal,
932 "C_DigestFinal hSession pDigest pulDigestLen\n\n"
933 "C_DigestFinal finishes a multiple-part message-digesting operation.\n"
934 " hSession the session's handle\n"
935 " pDigest gets the message digest\n"
936 " pulDigestLen gets byte count of digest\n",
937 {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
938 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
939 {"C_Digest", F_C_Digest,
940 "C_Digest hSession pData ulDataLen pDigest pulDigestLen\n\n"
941 "C_Digest digests data in a single part.\n"
942 " hSession the session's handle\n"
943 " pData data to be digested\n"
944 " ulDataLen bytes of data to digest\n"
945 " pDigest gets the message digest\n"
946 " pulDigestLen gets digest length\n",
947 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
948 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
949 {"C_SignInit", F_C_SignInit,
950 "C_SignInit hSession pMechanism hKey\n\n"
951 "C_SignInit initializes a signature (private key encryption operation where\n"
952 "the signature is (will be) an appendix to the data and plaintext cannot be\n"
953 "recovered from the signature.\n"
954 " hSession the session's handle\n"
955 " pMechanism the signature mechanism\n"
956 " hKey handle of signature key\n",
957 {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
958 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
959 {"C_SignUpdate", F_C_SignUpdate,
960 "C_SignUpdate hSession pPart ulPartLen\n\n"
961 "C_SignUpdate continues a multiple-part signature operation where the\n"
962 "signature is (will be) an appendix to the data and plaintext cannot be\n"
963 "recovered from the signature.\n"
964 " hSession the session's handle\n"
965 " pPart the data to sign\n"
966 " ulPartLen count of bytes to sign\n",
967 {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
968 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
969 {"C_SignFinal", F_C_SignFinal,
970 "C_SignFinal hSession pSignature pulSignatureLen\n\n"
971 "C_SignFinal finishes a multiple-part signature operation returning the\n"
972 "signature.\n"
973 " hSession the session's handle\n"
974 " pSignature gets the signature\n"
975 " pulSignatureLen gets signature length\n",
976 {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
977 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
978 {"C_SignRecoverInit", F_C_SignRecoverInit,
979 "C_SignRecoverInit hSession pMechanism hKey\n\n"
980 "C_SignRecoverInit initializes a signature operation where the data can be\n"
981 "recovered from the signature.\n"
982 " hSession the session's handle\n"
983 " pMechanism the signature mechanism\n"
984 " hKey handle of the signature key\n",
985 {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
986 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
987 {"C_SignRecover", F_C_SignRecover,
988 "C_SignRecover hSession pData ulDataLen pSignature pulSignatureLen\n\n"
989 "C_SignRecover signs data in a single operation where the data can be\n"
990 "recovered from the signature.\n"
991 " hSession the session's handle\n"
992 " pData the data to sign\n"
993 " ulDataLen count of bytes to sign\n"
994 " pSignature gets the signature\n"
995 " pulSignatureLen gets signature length\n",
996 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
997 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
998 {"C_Sign", F_C_Sign,
999 "C_Sign hSession pData ulDataLen pSignature pulSignatureLen\n\n"
1000 "C_Sign signs (encrypts with private key) data in a single part where the\n"
1001 "signature is (will be) an appendix to the data and plaintext cannot be\n"
1002 "recovered from the signature.\n"
1003 " hSession the session's handle\n"
1004 " pData the data to sign\n"
1005 " ulDataLen count of bytes to sign\n"
1006 " pSignature gets the signature\n"
1007 " pulSignatureLen gets signature length\n",
1008 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1009 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1010 {"C_VerifyInit", F_C_VerifyInit,
1011 "C_VerifyInit hSession pMechanism hKey\n\n"
1012 "C_VerifyInit initializes a verification operation where the signature is an\n"
1013 "appendix to the data and plaintext cannot cannot be recovered from the\n"
1014 "signature (e.g. DSA).\n"
1015 " hSession the session's handle\n"
1016 " pMechanism the verification mechanism\n"
1017 " hKey verification key\n",
1018 {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
1019 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1020 {"C_VerifyUpdate", F_C_VerifyUpdate,
1021 "C_VerifyUpdate hSession pPart ulPartLen\n\n"
1022 "C_VerifyUpdate continues a multiple-part verification operation where the\n"
1023 "signature is an appendix to the data and plaintext cannot be recovered from\n"
1024 "the signature.\n"
1025 " hSession the session's handle\n"
1026 " pPart signed data\n"
1027 " ulPartLen length of signed data\n",
1028 {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
1029 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1030 {"C_VerifyFinal", F_C_VerifyFinal,
1031 "C_VerifyFinal hSession pSignature ulSignatureLen\n\n"
1032 "C_VerifyFinal finishes a multiple-part verification operation checking the\n"
1033 "signature.\n"
1034 " hSession the session's handle\n"
1035 " pSignature signature to verify\n"
1036 " ulSignatureLen signature length\n",
1037 {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
1038 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1039 {"C_VerifyRecoverInit", F_C_VerifyRecoverInit,
1040 "C_VerifyRecoverInit hSession pMechanism hKey\n\n"
1041 "C_VerifyRecoverInit initializes a signature verification operation where the\n"
1042 "data is recovered from the signature.\n"
1043 " hSession the session's handle\n"
1044 " pMechanism the verification mechanism\n"
1045 " hKey verification key\n",
1046 {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
1047 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1048 {"C_VerifyRecover", F_C_VerifyRecover,
1049 "C_VerifyRecover hSession pSignature ulSignatureLen pData pulDataLen\n\n"
1050 "C_VerifyRecover verifies a signature in a single-part operation where the\n"
1051 "data is recovered from the signature.\n"
1052 " hSession the session's handle\n"
1053 " pSignature signature to verify\n"
1054 " ulSignatureLen signature length\n"
1055 " pData gets signed data\n"
1056 " pulDataLen gets signed data len\n",
1057 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1058 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1059 {"C_Verify", F_C_Verify,
1060 "C_Verify hSession pData ulDataLen pSignature ulSignatureLen\n\n"
1061 "C_Verify verifies a signature in a single-part operation where the signature\n"
1062 "is an appendix to the data and plaintext cannot be recovered from the\n"
1063 "signature.\n"
1064 " hSession the session's handle\n"
1065 " pData signed data\n"
1066 " ulDataLen length of signed data\n"
1067 " pSignature signature\n"
1068 " ulSignatureLen signature length*/\n",
1069 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1070 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1071 {"C_DigestEncryptUpdate", F_C_DigestEncryptUpdate,
1072 "C_DigestEncryptUpdate hSession pPart ulPartLen pEncryptedPart \\\n"
1073 " pulEncryptedPartLen\n\n"
1074 "C_DigestEncryptUpdate continues a multiple-part digesting and encryption\n"
1075 "operation.\n"
1076 " hSession session's handle\n"
1077 " pPart the plaintext data\n"
1078 " ulPartLen plaintext length\n"
1079 " pEncryptedPart gets ciphertext\n"
1080 " pulEncryptedPartLen gets c-text length\n",
1081 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1082 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1083 {"C_DecryptDigestUpdate", F_C_DecryptDigestUpdate,
1084 "C_DecryptDigestUpdate hSession pEncryptedPart ulEncryptedPartLen pPart \\\n"
1085 " pulPartLen\n\n"
1086 "C_DecryptDigestUpdate continues a multiple-part decryption and digesting\n"
1087 "operation.\n"
1088 " hSession session's handle\n"
1089 " pEncryptedPart ciphertext\n"
1090 " ulEncryptedPartLen ciphertext length\n"
1091 " pPart gets plaintext\n"
1092 " pulPartLen gets plaintext len\n",
1093 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1094 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1095 {"C_SignEncryptUpdate", F_C_SignEncryptUpdate,
1096 "C_SignEncryptUpdate hSession pPart ulPartLen pEncryptedPart \\\n"
1097 " pulEncryptedPartLen\n\n"
1098 "C_SignEncryptUpdate continues a multiple-part signing and encryption\n"
1099 "operation.\n"
1100 " hSession session's handle\n"
1101 " pPart the plaintext data\n"
1102 " ulPartLen plaintext length\n"
1103 " pEncryptedPart gets ciphertext\n"
1104 " pulEncryptedPartLen gets c-text length\n",
1105 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1106 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1107 {"C_DecryptVerifyUpdate", F_C_DecryptVerifyUpdate,
1108 "C_DecryptVerifyUpdate hSession pEncryptedPart ulEncryptedPartLen pPart \\\n"
1109 " pulPartLen\n\n"
1110 "C_DecryptVerifyUpdate continues a multiple-part decryption and verify\n"
1111 "operation.\n"
1112 " hSession session's handle\n"
1113 " pEncryptedPart ciphertext\n"
1114 " ulEncryptedPartLen ciphertext length\n"
1115 " pPart gets plaintext\n"
1116 " pulPartLen gets p-text length\n",
1117 {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
1118 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1119 {"C_GenerateKeyPair", F_C_GenerateKeyPair,
1120 "C_GenerateKeyPair hSession pMechanism pPublicKeyTemplate \\\n"
1121 " ulPublicKeyAttributeCount pPrivateKeyTemplate ulPrivateKeyAttributeCount \\\n"
1122 " phPublicKey phPrivateKey\n\n"
1123 "C_GenerateKeyPair generates a public-key/private-key pair creating new key\n"
1124 "objects.\n"
1125 " hSession sessionhandle\n"
1126 " pMechanism key-genmech.\n"
1127 " pPublicKeyTemplate templatefor pub. key\n"
1128 " ulPublicKeyAttributeCount # pub. attrs.\n"
1129 " pPrivateKeyTemplate templatefor priv. key\n"
1130 " ulPrivateKeyAttributeCount # priv. attrs.\n"
1131 " phPublicKey gets pub. keyhandle\n"
1132 " phPrivateKey getspriv. keyhandle\n",
1133 {ArgULong, ArgMechanism, ArgAttribute|ArgArray, ArgULong,
1134 ArgAttribute|ArgArray,
1135 ArgULong, ArgULong|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone }},
1136 {"C_GenerateKey", F_C_GenerateKey,
1137 "C_GenerateKey hSession pMechanism pTemplate ulCount phKey\n\n"
1138 "C_GenerateKey generates a secret key creating a new key object.\n"
1139 " hSession the session's handle\n"
1140 " pMechanism key generation mech.\n"
1141 " pTemplate template for new key\n"
1142 " ulCount # of attrs in template\n"
1143 " phKey gets handle of new key\n",
1144 {ArgULong, ArgMechanism, ArgAttribute|ArgArray, ArgULong,
1145 ArgULong|ArgOut,
1146 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1147 {"C_WrapKey", F_C_WrapKey,
1148 "C_WrapKey hSession pMechanism hWrappingKey hKey pWrappedKey pulWrappedKeyLen\n\n"
1149 "C_WrapKey wraps (i.e. encrypts) a key.\n"
1150 " hSession the session's handle\n"
1151 " pMechanism the wrapping mechanism\n"
1152 " hWrappingKey wrapping key\n"
1153 " hKey key to be wrapped\n"
1154 " pWrappedKey gets wrapped key\n"
1155 " pulWrappedKeyLen gets wrapped key size\n",
1156 {ArgULong, ArgMechanism, ArgULong, ArgULong, ArgULong,
1157 ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone, ArgNone }},
1158 {"C_UnwrapKey", F_C_UnwrapKey,
1159 "C_UnwrapKey hSession pMechanism hUnwrappingKey pWrappedKey ulWrappedKeyLen \\\n"
1160 " pTemplate ulAttributeCount phKey\n\n"
1161 "C_UnwrapKey unwraps (decrypts) a wrapped key creating a new key object.\n"
1162 " hSession session's handle\n"
1163 " pMechanism unwrapping mech.\n"
1164 " hUnwrappingKey unwrapping key\n"
1165 " pWrappedKey the wrapped key\n"
1166 " ulWrappedKeyLen wrapped key len\n"
1167 " pTemplate new key template\n"
1168 " ulAttributeCount template length\n"
1169 " phKey gets new handle\n",
1170 {ArgULong, ArgMechanism, ArgULong, ArgChar, ArgULong,
1171 ArgAttribute|ArgArray, ArgULong, ArgULong|ArgOut, ArgNone, ArgNone }},
1172 {"C_DeriveKey", F_C_DeriveKey,
1173 "C_DeriveKey hSession pMechanism hBaseKey pTemplate ulAttributeCount phKey\n\n"
1174 "C_DeriveKey derives a key from a base key creating a new key object.\n"
1175 " hSession session's handle\n"
1176 " pMechanism key deriv. mech.\n"
1177 " hBaseKey base key\n"
1178 " pTemplate new key template\n"
1179 " ulAttributeCount template length\n"
1180 " phKey gets new handle\n",
1181 {ArgULong, ArgMechanism, ArgULong, ArgAttribute|ArgArray, ArgULong,
1182 ArgULong|ArgOut, ArgNone, ArgNone, ArgNone, ArgNone }},
1183 {"C_SeedRandom", F_C_SeedRandom,
1184 "C_SeedRandom hSession pSeed ulSeedLen\n\n"
1185 "C_SeedRandom mixes additional seed material into the token's random number\n"
1186 "generator.\n"
1187 " hSession the session's handle\n"
1188 " pSeed the seed material\n"
1189 " ulSeedLen length of seed material\n",
1190 {ArgULong, ArgChar, ArgULong, ArgNone, ArgNone,
1191 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1192 {"C_GenerateRandom", F_C_GenerateRandom,
1193 "C_GenerateRandom hSession RandomData ulRandomLen\n\n"
1194 "C_GenerateRandom generates random data.\n"
1195 " hSession the session's handle\n"
1196 " RandomData receives the random data\n"
1197 " ulRandomLen # of bytes to generate\n",
1198 {ArgULong, ArgChar, ArgULong, ArgNone, ArgNone,
1199 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1200 {"C_GetFunctionStatus", F_C_GetFunctionStatus,
1201 "C_GetFunctionStatus hSession\n\n"
1202 "C_GetFunctionStatus is a legacy function; it obtains an updated status of\n"
1203 "a function running in parallel with an application.\n"
1204 " hSession the session's handle\n",
1205 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
1206 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1207 {"C_CancelFunction", F_C_CancelFunction,
1208 "C_CancelFunction hSession\n\n"
1209 "C_CancelFunction is a legacy function; it cancels a function running in\n"
1210 "parallel.\n"
1211 " hSession the session's handle\n",
1212 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
1213 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1214 {"C_WaitForSlotEvent", F_C_WaitForSlotEvent,
1215 "C_WaitForSlotEvent flags pSlot pRserved\n\n"
1216 "C_WaitForSlotEvent waits for a slot event (token insertion removal etc.)\n"
1217 "to occur.\n"
1218 " flags blocking/nonblocking flag\n"
1219 " pSlot location that receives the slot ID\n"
1220 " pRserved reserved. Should be NULL_PTR\n",
1221 {ArgULong, ArgULong|ArgArray, ArgVar, ArgNone, ArgNone,
1222 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1223 {"NewArray", F_NewArray,
1224 "NewArray varName varType array size\n\n"
1225 "Creates a new array variable.\n"
1226 " varName variable name of the new array\n"
1227 " varType data type of the new array\n"
1228 " size number of elements in the array\n",
1229 {ArgVar|ArgNew, ArgVar, ArgULong, ArgNone, ArgNone,
1230 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1231 {"NewInitArg", F_NewInitializeArgs,
1232 "NewInitArg varName flags string\n\n"
1233 "Creates a new init variable.\n"
1234 " varName variable name of the new initArg\n"
1235 " flags value to set the flags field\n"
1236 " string string parameter for init arg\n",
1237 {ArgVar|ArgNew, ArgULong, ArgVar|ArgNew, ArgNone, ArgNone,
1238 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1239 {"NewTemplate", F_NewTemplate,
1240 "NewTemplate varName attributeList\n\n"
1241 "Create a new empty template and populate the attribute list\n"
1242 " varName variable name of the new template\n"
1243 " attributeList comma separated list of CKA_ATTRIBUTE types\n",
1244 {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone,
1245 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1246 {"NewMechanism", F_NewMechanism,
1247 "NewMechanism varName mechanismType\n\n"
1248 "Create a new CK_MECHANISM object with type NULL paramters and specified type\n"
1249 " varName variable name of the new mechansim\n"
1250 " mechanismType CKM_ mechanism type value to set int the type field\n",
1251 {ArgVar|ArgNew, ArgULong, ArgNone, ArgNone, ArgNone,
1252 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1253 {"BuildTemplate", F_BuildTemplate,
1254 "BuildTemplate template\n\n"
1255 "Allocates space for the value in a template which has the sizes filled in,\n"
1256 "but no values allocated yet.\n"
1257 " template variable name of the template\n",
1258 {ArgAttribute, ArgNone, ArgNone, ArgNone, ArgNone,
1259 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1260 {"SetTemplate", F_SetTemplate,
1261 "SetTemplate template index value\n\n"
1262 "Sets a particular element of a template to a CK_ULONG\n"
1263 " template variable name of the template\n"
1264 " index index into the template to the element to change\n"
1265 " value 32 bit value to set in the template\n",
1266 {ArgAttribute, ArgULong, ArgULong, ArgNone, ArgNone,
1267 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1268 {"SetString", F_SetStringVar,
1269 "SetString varName string\n\n"
1270 "Sets a particular variable to a string value\n"
1271 " variable variable name of new string\n"
1272 " string String to set the variable to\n",
1273 {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone,
1274 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1275 {"Set", F_SetVar,
1276 "Set varName value\n\n"
1277 "Sets a particular variable to CK_ULONG\n"
1278 " variable name of the new variable\n"
1279 " value 32 bit value to set variable to\n",
1280 {ArgVar|ArgNew, ArgULong, ArgNone, ArgNone, ArgNone,
1281 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1282 {"Print", F_Print,
1283 "Print varName\n\n"
1284 "prints a variable\n"
1285 " variable name of the variable to print\n",
1286 {ArgVar, ArgNone, ArgNone, ArgNone, ArgNone,
1287 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1288 {"Delete", F_Delete,
1289 "Delete varName\n\n"
1290 "delete a variable\n"
1291 " variable name of the variable to delete\n",
1292 {ArgVar|ArgNew, ArgNone, ArgNone, ArgNone, ArgNone,
1293 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1294 {"Load", F_Load,
1295 "load libraryName\n\n"
1296 "load a pkcs #11 module\n"
1297 " libraryName Name of a shared library\n",
1298 {ArgVar, ArgNone, ArgNone, ArgNone, ArgNone,
1299 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1300 {"Save", F_SaveVar,
1301 "Save filename variable\n\n"
1302 "Saves the binary value of 'variable' in file 'filename'\n"
1303 " fileName target file to save the variable in\n"
1304 " variable variable to save\n",
1305 {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone,
1306 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1307 {"Restore", F_RestoreVar,
1308 "Restore filename variable\n\n"
1309 "Restores a variable from a file\n"
1310 " fileName target file to restore the variable from\n"
1311 " variable variable to restore\n",
1312 {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone,
1313 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1314 {"Increment", F_Increment,
1315 "Increment variable value\n\n"
1316 "Increment a variable by value\n",
1317 {ArgVar, ArgULong, ArgNone, ArgNone, ArgNone,
1318 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1319 {"Decrement", F_Decrement,
1320 "Decrement variable value\n\n"
1321 "Decrement a variable by value\n",
1322 {ArgVar, ArgULong, ArgNone, ArgNone, ArgNone,
1323 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1324 {"List", F_List,
1325 "List all the variables\n",
1326 {ArgNone, ArgNone, ArgNone, ArgNone, ArgNone,
1327 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1328 {"Unload", F_Unload,
1329 "Unload the currrently loaded PKCS #11 library\n",
1330 {ArgNone, ArgNone, ArgNone, ArgNone, ArgNone,
1331 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1332 {"Run", F_Run,
1333 "Run filename\n\n"
1334 "reads filename as script of commands to execute\n",
1335 {ArgVar|ArgNew, ArgNone, ArgNone, ArgNone, ArgNone,
1336 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1337 {"Time", F_Time,
1338 "Time pkcs11 command\n\n"
1339 "Execute a pkcs #11 command and time the results\n",
1340 {ArgVar|ArgFull, ArgNone, ArgNone, ArgNone, ArgNone,
1341 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1342 {"System", F_System,
1343 "Set System Flag",
1344 {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
1345 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1346 {"LoopRun", F_Loop,
1347 "LoopRun filename var start end step\n\n"
1348 "Run in a loop. Loop exit if scrip does and explicit quit (Quit QuitIf etc.)",
1349 {ArgVar|ArgNew, ArgVar|ArgNew, ArgULong, ArgULong, ArgULong,
1350 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1351 {"Help", F_Help,
1352 "Help [command]\n\n"
1353 "print general help, or help for a specific command\n",
1354 {ArgVar|ArgOpt, ArgNone, ArgNone, ArgNone, ArgNone,
1355 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1356 {"QuitIf", F_QuitIf,
1357 "QuitIf arg1 comparator arg2\n\n"
1358 "Exit from this program if Condition is valid, valid comparators:\n"
1359 " < > <= >= = !=\n",
1360 {ArgULong, ArgVar|ArgNew, ArgULong, ArgNone, ArgNone,
1361 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1362 {"QuitIfString", F_QuitIfString,
1363 "QuitIfString arg1 comparator arg2\n\n"
1364 "Exit from this program if Condition is valid, valid comparators:\n"
1365 " = !=\n",
1366 {ArgVar|ArgNew, ArgVar|ArgNew, ArgVar|ArgNew, ArgNone, ArgNone,
1367 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1368 {"Quit", F_Quit,
1369 "Exit from this program",
1370 {ArgNone, ArgNone, ArgNone, ArgNone, ArgNone,
1371 ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
1374 const Commands *commands= &_commands[0];
1375 const int commandCount = sizeof(_commands) / sizeof(_commands[0]);
1377 const Topics _topics[] = {
1378 { "variables",
1379 "Variables are random strings of characters. These should begin with alpha\n"
1380 " characters, and should not contain any spaces, nor should they match any\n"
1381 " built-in constants. There is some checking in the code for these things,\n"
1382 " but it's not 100% and using invalid variable names can cause problems.\n"
1383 " Variables are created by any 'OUT' parameter. If the variable does not\n"
1384 " exist, it will be created. For in parameters variables must already exist.\n"
1386 { "constants",
1387 "pk11util recognizes *lots* of constants. All CKA_, CKF_, CKO_, CKU_, CKS_,\n"
1388 " CKC_, CKK_, CKH_, CKM_, CKT_ values from the PKCS #11 spec are recognized.\n"
1389 " Constants can be specified with their fully qualified CK?_ value, or the\n"
1390 " prefix can be dropped. Constants are matched case insensitve.\n"
1392 { "arrays",
1393 "Arrays are special variables which represent 'C' arrays. Each array \n"
1394 " variable can be referenced as a group (using just the name), or as \n"
1395 " individual elements (with the [int] operator). Example:\n"
1396 " print myArray # prints the full array.\n"
1397 " print myArray[3] # prints the 3rd elemement of the array \n"
1399 { "sizes",
1400 "Size operaters returns the size in bytes of a variable, or the number of\n"
1401 " elements in an array.\n"
1402 " size(var) and sizeof(var) return the size of var in bytes.\n"
1403 " sizea(var) and sizeofarray(var) return the number of elements in var.\n"
1404 " If var is not an array, sizea(var) returns 1.\n"
1408 const Topics *topics=&_topics[0];
1409 const int topicCount = sizeof(_topics)/sizeof(_topics[0]);