3 /* pkcs11t.h include file for PKCS #11. */
6 /* License to copy and use this software is granted provided that it is
7 * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
8 * (Cryptoki)" in all material mentioning or referencing this software.
10 * License is also granted to make and use derivative works provided that
11 * such works are identified as "derived from the RSA Security Inc. PKCS #11
12 * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
13 * referencing the derived work.
15 * RSA Security Inc. makes no representations concerning either the
16 * merchantability of this software or the suitability of this software for
17 * any particular purpose. It is provided "as is" without express or implied
18 * warranty of any kind.
21 /* See top of pkcs11.h for information about the macros that
22 * must be defined and the structure-packing conventions that
23 * must be set before including this file. */
28 #define CRYPTOKI_VERSION_MAJOR 2
29 #define CRYPTOKI_VERSION_MINOR 20
30 #define CRYPTOKI_VERSION_AMENDMENT 3
35 #ifndef CK_DISABLE_TRUE_FALSE
37 #define FALSE CK_FALSE
45 /* an unsigned 8-bit value */
46 typedef unsigned char CK_BYTE
;
48 /* an unsigned 8-bit character */
49 typedef CK_BYTE CK_CHAR
;
51 /* an 8-bit UTF-8 character */
52 typedef CK_BYTE CK_UTF8CHAR
;
54 /* a BYTE-sized Boolean flag */
55 typedef CK_BYTE CK_BBOOL
;
57 /* an unsigned value, at least 32 bits long */
58 typedef unsigned long int CK_ULONG
;
60 /* a signed value, the same size as a CK_ULONG */
61 /* CK_LONG is new for v2.0 */
62 typedef long int CK_LONG
;
64 /* at least 32 bits; each bit is a Boolean flag */
65 typedef CK_ULONG CK_FLAGS
;
68 /* some special values for certain CK_ULONG variables */
69 #define CK_UNAVAILABLE_INFORMATION (~0UL)
70 #define CK_EFFECTIVELY_INFINITE 0
73 typedef CK_BYTE CK_PTR CK_BYTE_PTR
;
74 typedef CK_CHAR CK_PTR CK_CHAR_PTR
;
75 typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR
;
76 typedef CK_ULONG CK_PTR CK_ULONG_PTR
;
77 typedef void CK_PTR CK_VOID_PTR
;
79 /* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */
80 typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR
;
83 /* The following value is always invalid if used as a session */
84 /* handle or object handle */
85 #define CK_INVALID_HANDLE 0
88 typedef struct CK_VERSION
{
89 CK_BYTE major
; /* integer portion of version number */
90 CK_BYTE minor
; /* 1/100ths portion of version number */
93 typedef CK_VERSION CK_PTR CK_VERSION_PTR
;
96 typedef struct CK_INFO
{
97 /* manufacturerID and libraryDecription have been changed from
98 * CK_CHAR to CK_UTF8CHAR for v2.10 */
99 CK_VERSION cryptokiVersion
; /* Cryptoki interface ver */
100 CK_UTF8CHAR manufacturerID
[32]; /* blank padded */
101 CK_FLAGS flags
; /* must be zero */
103 /* libraryDescription and libraryVersion are new for v2.0 */
104 CK_UTF8CHAR libraryDescription
[32]; /* blank padded */
105 CK_VERSION libraryVersion
; /* version of library */
108 typedef CK_INFO CK_PTR CK_INFO_PTR
;
111 /* CK_NOTIFICATION enumerates the types of notifications that
112 * Cryptoki provides to an application */
113 /* CK_NOTIFICATION has been changed from an enum to a CK_ULONG
115 typedef CK_ULONG CK_NOTIFICATION
;
116 #define CKN_SURRENDER 0
118 /* The following notification is new for PKCS #11 v2.20 amendment 3 */
119 #define CKN_OTP_CHANGED 1
122 typedef CK_ULONG CK_SLOT_ID
;
124 typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR
;
127 /* CK_SLOT_INFO provides information about a slot */
128 typedef struct CK_SLOT_INFO
{
129 /* slotDescription and manufacturerID have been changed from
130 * CK_CHAR to CK_UTF8CHAR for v2.10 */
131 CK_UTF8CHAR slotDescription
[64]; /* blank padded */
132 CK_UTF8CHAR manufacturerID
[32]; /* blank padded */
135 /* hardwareVersion and firmwareVersion are new for v2.0 */
136 CK_VERSION hardwareVersion
; /* version of hardware */
137 CK_VERSION firmwareVersion
; /* version of firmware */
140 /* flags: bit flags that provide capabilities of the slot
141 * Bit Flag Mask Meaning
143 #define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */
144 #define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/
145 #define CKF_HW_SLOT 0x00000004 /* hardware slot */
147 typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR
;
150 /* CK_TOKEN_INFO provides information about a token */
151 typedef struct CK_TOKEN_INFO
{
152 /* label, manufacturerID, and model have been changed from
153 * CK_CHAR to CK_UTF8CHAR for v2.10 */
154 CK_UTF8CHAR label
[32]; /* blank padded */
155 CK_UTF8CHAR manufacturerID
[32]; /* blank padded */
156 CK_UTF8CHAR model
[16]; /* blank padded */
157 CK_CHAR serialNumber
[16]; /* blank padded */
158 CK_FLAGS flags
; /* see below */
160 /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount,
161 * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been
162 * changed from CK_USHORT to CK_ULONG for v2.0 */
163 CK_ULONG ulMaxSessionCount
; /* max open sessions */
164 CK_ULONG ulSessionCount
; /* sess. now open */
165 CK_ULONG ulMaxRwSessionCount
; /* max R/W sessions */
166 CK_ULONG ulRwSessionCount
; /* R/W sess. now open */
167 CK_ULONG ulMaxPinLen
; /* in bytes */
168 CK_ULONG ulMinPinLen
; /* in bytes */
169 CK_ULONG ulTotalPublicMemory
; /* in bytes */
170 CK_ULONG ulFreePublicMemory
; /* in bytes */
171 CK_ULONG ulTotalPrivateMemory
; /* in bytes */
172 CK_ULONG ulFreePrivateMemory
; /* in bytes */
174 /* hardwareVersion, firmwareVersion, and time are new for
176 CK_VERSION hardwareVersion
; /* version of hardware */
177 CK_VERSION firmwareVersion
; /* version of firmware */
178 CK_CHAR utcTime
[16]; /* time */
181 /* The flags parameter is defined as follows:
182 * Bit Flag Mask Meaning
184 #define CKF_RNG 0x00000001 /* has random #
186 #define CKF_WRITE_PROTECTED 0x00000002 /* token is
189 #define CKF_LOGIN_REQUIRED 0x00000004 /* user must
191 #define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's
194 /* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set,
195 * that means that *every* time the state of cryptographic
196 * operations of a session is successfully saved, all keys
197 * needed to continue those operations are stored in the state */
198 #define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020
200 /* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means
201 * that the token has some sort of clock. The time on that
202 * clock is returned in the token info structure */
203 #define CKF_CLOCK_ON_TOKEN 0x00000040
205 /* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is
206 * set, that means that there is some way for the user to login
207 * without sending a PIN through the Cryptoki library itself */
208 #define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100
210 /* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true,
211 * that means that a single session with the token can perform
212 * dual simultaneous cryptographic operations (digest and
213 * encrypt; decrypt and digest; sign and encrypt; and decrypt
215 #define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200
217 /* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the
218 * token has been initialized using C_InitializeToken or an
219 * equivalent mechanism outside the scope of PKCS #11.
220 * Calling C_InitializeToken when this flag is set will cause
221 * the token to be reinitialized. */
222 #define CKF_TOKEN_INITIALIZED 0x00000400
224 /* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is
225 * true, the token supports secondary authentication for
226 * private key objects. This flag is deprecated in v2.11 and
228 #define CKF_SECONDARY_AUTHENTICATION 0x00000800
230 /* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an
231 * incorrect user login PIN has been entered at least once
232 * since the last successful authentication. */
233 #define CKF_USER_PIN_COUNT_LOW 0x00010000
235 /* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true,
236 * supplying an incorrect user PIN will it to become locked. */
237 #define CKF_USER_PIN_FINAL_TRY 0x00020000
239 /* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the
240 * user PIN has been locked. User login to the token is not
242 #define CKF_USER_PIN_LOCKED 0x00040000
244 /* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
245 * the user PIN value is the default value set by token
246 * initialization or manufacturing, or the PIN has been
247 * expired by the card. */
248 #define CKF_USER_PIN_TO_BE_CHANGED 0x00080000
250 /* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an
251 * incorrect SO login PIN has been entered at least once since
252 * the last successful authentication. */
253 #define CKF_SO_PIN_COUNT_LOW 0x00100000
255 /* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true,
256 * supplying an incorrect SO PIN will it to become locked. */
257 #define CKF_SO_PIN_FINAL_TRY 0x00200000
259 /* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO
260 * PIN has been locked. SO login to the token is not possible.
262 #define CKF_SO_PIN_LOCKED 0x00400000
264 /* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
265 * the SO PIN value is the default value set by token
266 * initialization or manufacturing, or the PIN has been
267 * expired by the card. */
268 #define CKF_SO_PIN_TO_BE_CHANGED 0x00800000
270 typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR
;
273 /* CK_SESSION_HANDLE is a Cryptoki-assigned value that
274 * identifies a session */
275 typedef CK_ULONG CK_SESSION_HANDLE
;
277 typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR
;
280 /* CK_USER_TYPE enumerates the types of Cryptoki users */
281 /* CK_USER_TYPE has been changed from an enum to a CK_ULONG for
283 typedef CK_ULONG CK_USER_TYPE
;
284 /* Security Officer */
288 /* Context specific (added in v2.20) */
289 #define CKU_CONTEXT_SPECIFIC 2
291 /* CK_STATE enumerates the session states */
292 /* CK_STATE has been changed from an enum to a CK_ULONG for
294 typedef CK_ULONG CK_STATE
;
295 #define CKS_RO_PUBLIC_SESSION 0
296 #define CKS_RO_USER_FUNCTIONS 1
297 #define CKS_RW_PUBLIC_SESSION 2
298 #define CKS_RW_USER_FUNCTIONS 3
299 #define CKS_RW_SO_FUNCTIONS 4
302 /* CK_SESSION_INFO provides information about a session */
303 typedef struct CK_SESSION_INFO
{
306 CK_FLAGS flags
; /* see below */
308 /* ulDeviceError was changed from CK_USHORT to CK_ULONG for
310 CK_ULONG ulDeviceError
; /* device-dependent error code */
313 /* The flags are defined in the following table:
314 * Bit Flag Mask Meaning
316 #define CKF_RW_SESSION 0x00000002 /* session is r/w */
317 #define CKF_SERIAL_SESSION 0x00000004 /* no parallel */
319 typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR
;
322 /* CK_OBJECT_HANDLE is a token-specific identifier for an
324 typedef CK_ULONG CK_OBJECT_HANDLE
;
326 typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR
;
329 /* CK_OBJECT_CLASS is a value that identifies the classes (or
330 * types) of objects that Cryptoki recognizes. It is defined
332 /* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for
334 typedef CK_ULONG CK_OBJECT_CLASS
;
336 /* The following classes of objects are defined: */
337 /* CKO_HW_FEATURE is new for v2.10 */
338 /* CKO_DOMAIN_PARAMETERS is new for v2.11 */
339 /* CKO_MECHANISM is new for v2.20 */
340 #define CKO_DATA 0x00000000
341 #define CKO_CERTIFICATE 0x00000001
342 #define CKO_PUBLIC_KEY 0x00000002
343 #define CKO_PRIVATE_KEY 0x00000003
344 #define CKO_SECRET_KEY 0x00000004
345 #define CKO_HW_FEATURE 0x00000005
346 #define CKO_DOMAIN_PARAMETERS 0x00000006
347 #define CKO_MECHANISM 0x00000007
349 /* CKO_OTP_KEY is new for PKCS #11 v2.20 amendment 1 */
350 #define CKO_OTP_KEY 0x00000008
352 #define CKO_VENDOR_DEFINED 0x80000000
354 typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR
;
356 /* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a
357 * value that identifies the hardware feature type of an object
358 * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */
359 typedef CK_ULONG CK_HW_FEATURE_TYPE
;
361 /* The following hardware feature types are defined */
362 /* CKH_USER_INTERFACE is new for v2.20 */
363 #define CKH_MONOTONIC_COUNTER 0x00000001
364 #define CKH_CLOCK 0x00000002
365 #define CKH_USER_INTERFACE 0x00000003
366 #define CKH_VENDOR_DEFINED 0x80000000
368 /* CK_KEY_TYPE is a value that identifies a key type */
369 /* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */
370 typedef CK_ULONG CK_KEY_TYPE
;
372 /* the following key types are defined: */
373 #define CKK_RSA 0x00000000
374 #define CKK_DSA 0x00000001
375 #define CKK_DH 0x00000002
377 /* CKK_ECDSA and CKK_KEA are new for v2.0 */
378 /* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */
379 #define CKK_ECDSA 0x00000003
380 #define CKK_EC 0x00000003
381 #define CKK_X9_42_DH 0x00000004
382 #define CKK_KEA 0x00000005
384 #define CKK_GENERIC_SECRET 0x00000010
385 #define CKK_RC2 0x00000011
386 #define CKK_RC4 0x00000012
387 #define CKK_DES 0x00000013
388 #define CKK_DES2 0x00000014
389 #define CKK_DES3 0x00000015
391 /* all these key types are new for v2.0 */
392 #define CKK_CAST 0x00000016
393 #define CKK_CAST3 0x00000017
394 /* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */
395 #define CKK_CAST5 0x00000018
396 #define CKK_CAST128 0x00000018
397 #define CKK_RC5 0x00000019
398 #define CKK_IDEA 0x0000001A
399 #define CKK_SKIPJACK 0x0000001B
400 #define CKK_BATON 0x0000001C
401 #define CKK_JUNIPER 0x0000001D
402 #define CKK_CDMF 0x0000001E
403 #define CKK_AES 0x0000001F
405 /* BlowFish and TwoFish are new for v2.20 */
406 #define CKK_BLOWFISH 0x00000020
407 #define CKK_TWOFISH 0x00000021
409 /* SecurID, HOTP, and ACTI are new for PKCS #11 v2.20 amendment 1 */
410 #define CKK_SECURID 0x00000022
411 #define CKK_HOTP 0x00000023
412 #define CKK_ACTI 0x00000024
414 /* Camellia is new for PKCS #11 v2.20 amendment 3 */
415 #define CKK_CAMELLIA 0x00000025
416 /* ARIA is new for PKCS #11 v2.20 amendment 3 */
417 #define CKK_ARIA 0x00000026
420 #define CKK_VENDOR_DEFINED 0x80000000
423 /* CK_CERTIFICATE_TYPE is a value that identifies a certificate
425 /* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG
427 typedef CK_ULONG CK_CERTIFICATE_TYPE
;
429 /* The following certificate types are defined: */
430 /* CKC_X_509_ATTR_CERT is new for v2.10 */
431 /* CKC_WTLS is new for v2.20 */
432 #define CKC_X_509 0x00000000
433 #define CKC_X_509_ATTR_CERT 0x00000001
434 #define CKC_WTLS 0x00000002
435 #define CKC_VENDOR_DEFINED 0x80000000
438 /* CK_ATTRIBUTE_TYPE is a value that identifies an attribute
440 /* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for
442 typedef CK_ULONG CK_ATTRIBUTE_TYPE
;
444 /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which
445 consists of an array of values. */
446 #define CKF_ARRAY_ATTRIBUTE 0x40000000
448 /* The following OTP-related defines are new for PKCS #11 v2.20 amendment 1
449 and relates to the CKA_OTP_FORMAT attribute */
450 #define CK_OTP_FORMAT_DECIMAL 0
451 #define CK_OTP_FORMAT_HEXADECIMAL 1
452 #define CK_OTP_FORMAT_ALPHANUMERIC 2
453 #define CK_OTP_FORMAT_BINARY 3
455 /* The following OTP-related defines are new for PKCS #11 v2.20 amendment 1
456 and relates to the CKA_OTP_..._REQUIREMENT attributes */
457 #define CK_OTP_PARAM_IGNORED 0
458 #define CK_OTP_PARAM_OPTIONAL 1
459 #define CK_OTP_PARAM_MANDATORY 2
461 /* The following attribute types are defined: */
462 #define CKA_CLASS 0x00000000
463 #define CKA_TOKEN 0x00000001
464 #define CKA_PRIVATE 0x00000002
465 #define CKA_LABEL 0x00000003
466 #define CKA_APPLICATION 0x00000010
467 #define CKA_VALUE 0x00000011
469 /* CKA_OBJECT_ID is new for v2.10 */
470 #define CKA_OBJECT_ID 0x00000012
472 #define CKA_CERTIFICATE_TYPE 0x00000080
473 #define CKA_ISSUER 0x00000081
474 #define CKA_SERIAL_NUMBER 0x00000082
476 /* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new
478 #define CKA_AC_ISSUER 0x00000083
479 #define CKA_OWNER 0x00000084
480 #define CKA_ATTR_TYPES 0x00000085
482 /* CKA_TRUSTED is new for v2.11 */
483 #define CKA_TRUSTED 0x00000086
485 /* CKA_CERTIFICATE_CATEGORY ...
486 * CKA_CHECK_VALUE are new for v2.20 */
487 #define CKA_CERTIFICATE_CATEGORY 0x00000087
488 #define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088
489 #define CKA_URL 0x00000089
490 #define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008A
491 #define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008B
492 #define CKA_CHECK_VALUE 0x00000090
494 #define CKA_KEY_TYPE 0x00000100
495 #define CKA_SUBJECT 0x00000101
496 #define CKA_ID 0x00000102
497 #define CKA_SENSITIVE 0x00000103
498 #define CKA_ENCRYPT 0x00000104
499 #define CKA_DECRYPT 0x00000105
500 #define CKA_WRAP 0x00000106
501 #define CKA_UNWRAP 0x00000107
502 #define CKA_SIGN 0x00000108
503 #define CKA_SIGN_RECOVER 0x00000109
504 #define CKA_VERIFY 0x0000010A
505 #define CKA_VERIFY_RECOVER 0x0000010B
506 #define CKA_DERIVE 0x0000010C
507 #define CKA_START_DATE 0x00000110
508 #define CKA_END_DATE 0x00000111
509 #define CKA_MODULUS 0x00000120
510 #define CKA_MODULUS_BITS 0x00000121
511 #define CKA_PUBLIC_EXPONENT 0x00000122
512 #define CKA_PRIVATE_EXPONENT 0x00000123
513 #define CKA_PRIME_1 0x00000124
514 #define CKA_PRIME_2 0x00000125
515 #define CKA_EXPONENT_1 0x00000126
516 #define CKA_EXPONENT_2 0x00000127
517 #define CKA_COEFFICIENT 0x00000128
518 #define CKA_PRIME 0x00000130
519 #define CKA_SUBPRIME 0x00000131
520 #define CKA_BASE 0x00000132
522 /* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */
523 #define CKA_PRIME_BITS 0x00000133
524 #define CKA_SUBPRIME_BITS 0x00000134
525 #define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS
526 /* (To retain backwards-compatibility) */
528 #define CKA_VALUE_BITS 0x00000160
529 #define CKA_VALUE_LEN 0x00000161
531 /* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE,
532 * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS,
533 * and CKA_EC_POINT are new for v2.0 */
534 #define CKA_EXTRACTABLE 0x00000162
535 #define CKA_LOCAL 0x00000163
536 #define CKA_NEVER_EXTRACTABLE 0x00000164
537 #define CKA_ALWAYS_SENSITIVE 0x00000165
539 /* CKA_KEY_GEN_MECHANISM is new for v2.11 */
540 #define CKA_KEY_GEN_MECHANISM 0x00000166
542 #define CKA_MODIFIABLE 0x00000170
544 /* CKA_ECDSA_PARAMS is deprecated in v2.11,
545 * CKA_EC_PARAMS is preferred. */
546 #define CKA_ECDSA_PARAMS 0x00000180
547 #define CKA_EC_PARAMS 0x00000180
549 #define CKA_EC_POINT 0x00000181
551 /* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS,
552 * are new for v2.10. Deprecated in v2.11 and onwards. */
553 #define CKA_SECONDARY_AUTH 0x00000200
554 #define CKA_AUTH_PIN_FLAGS 0x00000201
556 /* CKA_ALWAYS_AUTHENTICATE ...
557 * CKA_UNWRAP_TEMPLATE are new for v2.20 */
558 #define CKA_ALWAYS_AUTHENTICATE 0x00000202
560 #define CKA_WRAP_WITH_TRUSTED 0x00000210
561 #define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211)
562 #define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212)
564 /* CKA_OTP... atttributes are new for PKCS #11 v2.20 amendment 3. */
565 #define CKA_OTP_FORMAT 0x00000220
566 #define CKA_OTP_LENGTH 0x00000221
567 #define CKA_OTP_TIME_INTERVAL 0x00000222
568 #define CKA_OTP_USER_FRIENDLY_MODE 0x00000223
569 #define CKA_OTP_CHALLENGE_REQUIREMENT 0x00000224
570 #define CKA_OTP_TIME_REQUIREMENT 0x00000225
571 #define CKA_OTP_COUNTER_REQUIREMENT 0x00000226
572 #define CKA_OTP_PIN_REQUIREMENT 0x00000227
573 #define CKA_OTP_COUNTER 0x0000022E
574 #define CKA_OTP_TIME 0x0000022F
575 #define CKA_OTP_USER_IDENTIFIER 0x0000022A
576 #define CKA_OTP_SERVICE_IDENTIFIER 0x0000022B
577 #define CKA_OTP_SERVICE_LOGO 0x0000022C
578 #define CKA_OTP_SERVICE_LOGO_TYPE 0x0000022D
581 /* CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET
582 * are new for v2.10 */
583 #define CKA_HW_FEATURE_TYPE 0x00000300
584 #define CKA_RESET_ON_INIT 0x00000301
585 #define CKA_HAS_RESET 0x00000302
587 /* The following attributes are new for v2.20 */
588 #define CKA_PIXEL_X 0x00000400
589 #define CKA_PIXEL_Y 0x00000401
590 #define CKA_RESOLUTION 0x00000402
591 #define CKA_CHAR_ROWS 0x00000403
592 #define CKA_CHAR_COLUMNS 0x00000404
593 #define CKA_COLOR 0x00000405
594 #define CKA_BITS_PER_PIXEL 0x00000406
595 #define CKA_CHAR_SETS 0x00000480
596 #define CKA_ENCODING_METHODS 0x00000481
597 #define CKA_MIME_TYPES 0x00000482
598 #define CKA_MECHANISM_TYPE 0x00000500
599 #define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501
600 #define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502
601 #define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503
602 #define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600)
604 #define CKA_VENDOR_DEFINED 0x80000000
606 /* CK_ATTRIBUTE is a structure that includes the type, length
607 * and value of an attribute */
608 typedef struct CK_ATTRIBUTE
{
609 CK_ATTRIBUTE_TYPE type
;
612 /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */
613 CK_ULONG ulValueLen
; /* in bytes */
616 typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR
;
619 /* CK_DATE is a structure that defines a date */
620 typedef struct CK_DATE
{
621 CK_CHAR year
[4]; /* the year ("1900" - "9999") */
622 CK_CHAR month
[2]; /* the month ("01" - "12") */
623 CK_CHAR day
[2]; /* the day ("01" - "31") */
627 /* CK_MECHANISM_TYPE is a value that identifies a mechanism
629 /* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for
631 typedef CK_ULONG CK_MECHANISM_TYPE
;
633 /* the following mechanism types are defined: */
634 #define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000
635 #define CKM_RSA_PKCS 0x00000001
636 #define CKM_RSA_9796 0x00000002
637 #define CKM_RSA_X_509 0x00000003
639 /* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS
640 * are new for v2.0. They are mechanisms which hash and sign */
641 #define CKM_MD2_RSA_PKCS 0x00000004
642 #define CKM_MD5_RSA_PKCS 0x00000005
643 #define CKM_SHA1_RSA_PKCS 0x00000006
645 /* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and
646 * CKM_RSA_PKCS_OAEP are new for v2.10 */
647 #define CKM_RIPEMD128_RSA_PKCS 0x00000007
648 #define CKM_RIPEMD160_RSA_PKCS 0x00000008
649 #define CKM_RSA_PKCS_OAEP 0x00000009
651 /* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31,
652 * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */
653 #define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A
654 #define CKM_RSA_X9_31 0x0000000B
655 #define CKM_SHA1_RSA_X9_31 0x0000000C
656 #define CKM_RSA_PKCS_PSS 0x0000000D
657 #define CKM_SHA1_RSA_PKCS_PSS 0x0000000E
659 #define CKM_DSA_KEY_PAIR_GEN 0x00000010
660 #define CKM_DSA 0x00000011
661 #define CKM_DSA_SHA1 0x00000012
662 #define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020
663 #define CKM_DH_PKCS_DERIVE 0x00000021
665 /* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE,
666 * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for
668 #define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030
669 #define CKM_X9_42_DH_DERIVE 0x00000031
670 #define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032
671 #define CKM_X9_42_MQV_DERIVE 0x00000033
673 /* CKM_SHA256/384/512 are new for v2.20 */
674 #define CKM_SHA256_RSA_PKCS 0x00000040
675 #define CKM_SHA384_RSA_PKCS 0x00000041
676 #define CKM_SHA512_RSA_PKCS 0x00000042
677 #define CKM_SHA256_RSA_PKCS_PSS 0x00000043
678 #define CKM_SHA384_RSA_PKCS_PSS 0x00000044
679 #define CKM_SHA512_RSA_PKCS_PSS 0x00000045
681 /* SHA-224 RSA mechanisms are new for PKCS #11 v2.20 amendment 3 */
682 #define CKM_SHA224_RSA_PKCS 0x00000046
683 #define CKM_SHA224_RSA_PKCS_PSS 0x00000047
685 #define CKM_RC2_KEY_GEN 0x00000100
686 #define CKM_RC2_ECB 0x00000101
687 #define CKM_RC2_CBC 0x00000102
688 #define CKM_RC2_MAC 0x00000103
690 /* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */
691 #define CKM_RC2_MAC_GENERAL 0x00000104
692 #define CKM_RC2_CBC_PAD 0x00000105
694 #define CKM_RC4_KEY_GEN 0x00000110
695 #define CKM_RC4 0x00000111
696 #define CKM_DES_KEY_GEN 0x00000120
697 #define CKM_DES_ECB 0x00000121
698 #define CKM_DES_CBC 0x00000122
699 #define CKM_DES_MAC 0x00000123
701 /* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */
702 #define CKM_DES_MAC_GENERAL 0x00000124
703 #define CKM_DES_CBC_PAD 0x00000125
705 #define CKM_DES2_KEY_GEN 0x00000130
706 #define CKM_DES3_KEY_GEN 0x00000131
707 #define CKM_DES3_ECB 0x00000132
708 #define CKM_DES3_CBC 0x00000133
709 #define CKM_DES3_MAC 0x00000134
711 /* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN,
712 * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC,
713 * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */
714 #define CKM_DES3_MAC_GENERAL 0x00000135
715 #define CKM_DES3_CBC_PAD 0x00000136
716 #define CKM_CDMF_KEY_GEN 0x00000140
717 #define CKM_CDMF_ECB 0x00000141
718 #define CKM_CDMF_CBC 0x00000142
719 #define CKM_CDMF_MAC 0x00000143
720 #define CKM_CDMF_MAC_GENERAL 0x00000144
721 #define CKM_CDMF_CBC_PAD 0x00000145
723 /* the following four DES mechanisms are new for v2.20 */
724 #define CKM_DES_OFB64 0x00000150
725 #define CKM_DES_OFB8 0x00000151
726 #define CKM_DES_CFB64 0x00000152
727 #define CKM_DES_CFB8 0x00000153
729 #define CKM_MD2 0x00000200
731 /* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */
732 #define CKM_MD2_HMAC 0x00000201
733 #define CKM_MD2_HMAC_GENERAL 0x00000202
735 #define CKM_MD5 0x00000210
737 /* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */
738 #define CKM_MD5_HMAC 0x00000211
739 #define CKM_MD5_HMAC_GENERAL 0x00000212
741 #define CKM_SHA_1 0x00000220
743 /* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */
744 #define CKM_SHA_1_HMAC 0x00000221
745 #define CKM_SHA_1_HMAC_GENERAL 0x00000222
747 /* CKM_RIPEMD128, CKM_RIPEMD128_HMAC,
748 * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC,
749 * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */
750 #define CKM_RIPEMD128 0x00000230
751 #define CKM_RIPEMD128_HMAC 0x00000231
752 #define CKM_RIPEMD128_HMAC_GENERAL 0x00000232
753 #define CKM_RIPEMD160 0x00000240
754 #define CKM_RIPEMD160_HMAC 0x00000241
755 #define CKM_RIPEMD160_HMAC_GENERAL 0x00000242
757 /* CKM_SHA256/384/512 are new for v2.20 */
758 #define CKM_SHA256 0x00000250
759 #define CKM_SHA256_HMAC 0x00000251
760 #define CKM_SHA256_HMAC_GENERAL 0x00000252
762 /* SHA-224 is new for PKCS #11 v2.20 amendment 3 */
763 #define CKM_SHA224 0x00000255
764 #define CKM_SHA224_HMAC 0x00000256
765 #define CKM_SHA224_HMAC_GENERAL 0x00000257
767 #define CKM_SHA384 0x00000260
768 #define CKM_SHA384_HMAC 0x00000261
769 #define CKM_SHA384_HMAC_GENERAL 0x00000262
770 #define CKM_SHA512 0x00000270
771 #define CKM_SHA512_HMAC 0x00000271
772 #define CKM_SHA512_HMAC_GENERAL 0x00000272
774 /* SecurID is new for PKCS #11 v2.20 amendment 1 */
775 #define CKM_SECURID_KEY_GEN 0x00000280
776 #define CKM_SECURID 0x00000282
778 /* HOTP is new for PKCS #11 v2.20 amendment 1 */
779 #define CKM_HOTP_KEY_GEN 0x00000290
780 #define CKM_HOTP 0x00000291
782 /* ACTI is new for PKCS #11 v2.20 amendment 1 */
783 #define CKM_ACTI 0x000002A0
784 #define CKM_ACTI_KEY_GEN 0x000002A1
786 /* All of the following mechanisms are new for v2.0 */
787 /* Note that CAST128 and CAST5 are the same algorithm */
788 #define CKM_CAST_KEY_GEN 0x00000300
789 #define CKM_CAST_ECB 0x00000301
790 #define CKM_CAST_CBC 0x00000302
791 #define CKM_CAST_MAC 0x00000303
792 #define CKM_CAST_MAC_GENERAL 0x00000304
793 #define CKM_CAST_CBC_PAD 0x00000305
794 #define CKM_CAST3_KEY_GEN 0x00000310
795 #define CKM_CAST3_ECB 0x00000311
796 #define CKM_CAST3_CBC 0x00000312
797 #define CKM_CAST3_MAC 0x00000313
798 #define CKM_CAST3_MAC_GENERAL 0x00000314
799 #define CKM_CAST3_CBC_PAD 0x00000315
800 #define CKM_CAST5_KEY_GEN 0x00000320
801 #define CKM_CAST128_KEY_GEN 0x00000320
802 #define CKM_CAST5_ECB 0x00000321
803 #define CKM_CAST128_ECB 0x00000321
804 #define CKM_CAST5_CBC 0x00000322
805 #define CKM_CAST128_CBC 0x00000322
806 #define CKM_CAST5_MAC 0x00000323
807 #define CKM_CAST128_MAC 0x00000323
808 #define CKM_CAST5_MAC_GENERAL 0x00000324
809 #define CKM_CAST128_MAC_GENERAL 0x00000324
810 #define CKM_CAST5_CBC_PAD 0x00000325
811 #define CKM_CAST128_CBC_PAD 0x00000325
812 #define CKM_RC5_KEY_GEN 0x00000330
813 #define CKM_RC5_ECB 0x00000331
814 #define CKM_RC5_CBC 0x00000332
815 #define CKM_RC5_MAC 0x00000333
816 #define CKM_RC5_MAC_GENERAL 0x00000334
817 #define CKM_RC5_CBC_PAD 0x00000335
818 #define CKM_IDEA_KEY_GEN 0x00000340
819 #define CKM_IDEA_ECB 0x00000341
820 #define CKM_IDEA_CBC 0x00000342
821 #define CKM_IDEA_MAC 0x00000343
822 #define CKM_IDEA_MAC_GENERAL 0x00000344
823 #define CKM_IDEA_CBC_PAD 0x00000345
824 #define CKM_GENERIC_SECRET_KEY_GEN 0x00000350
825 #define CKM_CONCATENATE_BASE_AND_KEY 0x00000360
826 #define CKM_CONCATENATE_BASE_AND_DATA 0x00000362
827 #define CKM_CONCATENATE_DATA_AND_BASE 0x00000363
828 #define CKM_XOR_BASE_AND_DATA 0x00000364
829 #define CKM_EXTRACT_KEY_FROM_KEY 0x00000365
830 #define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370
831 #define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371
832 #define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372
834 /* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN,
835 * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and
836 * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */
837 #define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373
838 #define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374
839 #define CKM_TLS_MASTER_KEY_DERIVE 0x00000375
840 #define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376
841 #define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377
843 /* CKM_TLS_PRF is new for v2.20 */
844 #define CKM_TLS_PRF 0x00000378
846 #define CKM_SSL3_MD5_MAC 0x00000380
847 #define CKM_SSL3_SHA1_MAC 0x00000381
848 #define CKM_MD5_KEY_DERIVATION 0x00000390
849 #define CKM_MD2_KEY_DERIVATION 0x00000391
850 #define CKM_SHA1_KEY_DERIVATION 0x00000392
852 /* CKM_SHA256/384/512 are new for v2.20 */
853 #define CKM_SHA256_KEY_DERIVATION 0x00000393
854 #define CKM_SHA384_KEY_DERIVATION 0x00000394
855 #define CKM_SHA512_KEY_DERIVATION 0x00000395
857 /* SHA-224 key derivation is new for PKCS #11 v2.20 amendment 3 */
858 #define CKM_SHA224_KEY_DERIVATION 0x00000396
860 #define CKM_PBE_MD2_DES_CBC 0x000003A0
861 #define CKM_PBE_MD5_DES_CBC 0x000003A1
862 #define CKM_PBE_MD5_CAST_CBC 0x000003A2
863 #define CKM_PBE_MD5_CAST3_CBC 0x000003A3
864 #define CKM_PBE_MD5_CAST5_CBC 0x000003A4
865 #define CKM_PBE_MD5_CAST128_CBC 0x000003A4
866 #define CKM_PBE_SHA1_CAST5_CBC 0x000003A5
867 #define CKM_PBE_SHA1_CAST128_CBC 0x000003A5
868 #define CKM_PBE_SHA1_RC4_128 0x000003A6
869 #define CKM_PBE_SHA1_RC4_40 0x000003A7
870 #define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8
871 #define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9
872 #define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA
873 #define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB
875 /* CKM_PKCS5_PBKD2 is new for v2.10 */
876 #define CKM_PKCS5_PBKD2 0x000003B0
878 #define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0
880 /* WTLS mechanisms are new for v2.20 */
881 #define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0
882 #define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1
883 #define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2
884 #define CKM_WTLS_PRF 0x000003D3
885 #define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4
886 #define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5
888 #define CKM_KEY_WRAP_LYNKS 0x00000400
889 #define CKM_KEY_WRAP_SET_OAEP 0x00000401
891 /* CKM_CMS_SIG is new for v2.20 */
892 #define CKM_CMS_SIG 0x00000500
894 /* CKM_KIP mechanisms are new for PKCS #11 v2.20 amendment 2 */
895 #define CKM_KIP_DERIVE 0x00000510
896 #define CKM_KIP_WRAP 0x00000511
897 #define CKM_KIP_MAC 0x00000512
899 /* Camellia is new for PKCS #11 v2.20 amendment 3 */
900 #define CKM_CAMELLIA_KEY_GEN 0x00000550
901 #define CKM_CAMELLIA_ECB 0x00000551
902 #define CKM_CAMELLIA_CBC 0x00000552
903 #define CKM_CAMELLIA_MAC 0x00000553
904 #define CKM_CAMELLIA_MAC_GENERAL 0x00000554
905 #define CKM_CAMELLIA_CBC_PAD 0x00000555
906 #define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556
907 #define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557
908 #define CKM_CAMELLIA_CTR 0x00000558
910 /* ARIA is new for PKCS #11 v2.20 amendment 3 */
911 #define CKM_ARIA_KEY_GEN 0x00000560
912 #define CKM_ARIA_ECB 0x00000561
913 #define CKM_ARIA_CBC 0x00000562
914 #define CKM_ARIA_MAC 0x00000563
915 #define CKM_ARIA_MAC_GENERAL 0x00000564
916 #define CKM_ARIA_CBC_PAD 0x00000565
917 #define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566
918 #define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567
920 /* Fortezza mechanisms */
921 #define CKM_SKIPJACK_KEY_GEN 0x00001000
922 #define CKM_SKIPJACK_ECB64 0x00001001
923 #define CKM_SKIPJACK_CBC64 0x00001002
924 #define CKM_SKIPJACK_OFB64 0x00001003
925 #define CKM_SKIPJACK_CFB64 0x00001004
926 #define CKM_SKIPJACK_CFB32 0x00001005
927 #define CKM_SKIPJACK_CFB16 0x00001006
928 #define CKM_SKIPJACK_CFB8 0x00001007
929 #define CKM_SKIPJACK_WRAP 0x00001008
930 #define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009
931 #define CKM_SKIPJACK_RELAYX 0x0000100a
932 #define CKM_KEA_KEY_PAIR_GEN 0x00001010
933 #define CKM_KEA_KEY_DERIVE 0x00001011
934 #define CKM_FORTEZZA_TIMESTAMP 0x00001020
935 #define CKM_BATON_KEY_GEN 0x00001030
936 #define CKM_BATON_ECB128 0x00001031
937 #define CKM_BATON_ECB96 0x00001032
938 #define CKM_BATON_CBC128 0x00001033
939 #define CKM_BATON_COUNTER 0x00001034
940 #define CKM_BATON_SHUFFLE 0x00001035
941 #define CKM_BATON_WRAP 0x00001036
943 /* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11,
944 * CKM_EC_KEY_PAIR_GEN is preferred */
945 #define CKM_ECDSA_KEY_PAIR_GEN 0x00001040
946 #define CKM_EC_KEY_PAIR_GEN 0x00001040
948 #define CKM_ECDSA 0x00001041
949 #define CKM_ECDSA_SHA1 0x00001042
951 /* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE
952 * are new for v2.11 */
953 #define CKM_ECDH1_DERIVE 0x00001050
954 #define CKM_ECDH1_COFACTOR_DERIVE 0x00001051
955 #define CKM_ECMQV_DERIVE 0x00001052
957 #define CKM_JUNIPER_KEY_GEN 0x00001060
958 #define CKM_JUNIPER_ECB128 0x00001061
959 #define CKM_JUNIPER_CBC128 0x00001062
960 #define CKM_JUNIPER_COUNTER 0x00001063
961 #define CKM_JUNIPER_SHUFFLE 0x00001064
962 #define CKM_JUNIPER_WRAP 0x00001065
963 #define CKM_FASTHASH 0x00001070
965 /* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC,
966 * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN,
967 * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are
969 #define CKM_AES_KEY_GEN 0x00001080
970 #define CKM_AES_ECB 0x00001081
971 #define CKM_AES_CBC 0x00001082
972 #define CKM_AES_MAC 0x00001083
973 #define CKM_AES_MAC_GENERAL 0x00001084
974 #define CKM_AES_CBC_PAD 0x00001085
976 /* AES counter mode is new for PKCS #11 v2.20 amendment 3 */
977 #define CKM_AES_CTR 0x00001086
979 /* BlowFish and TwoFish are new for v2.20 */
980 #define CKM_BLOWFISH_KEY_GEN 0x00001090
981 #define CKM_BLOWFISH_CBC 0x00001091
982 #define CKM_TWOFISH_KEY_GEN 0x00001092
983 #define CKM_TWOFISH_CBC 0x00001093
986 /* CKM_xxx_ENCRYPT_DATA mechanisms are new for v2.20 */
987 #define CKM_DES_ECB_ENCRYPT_DATA 0x00001100
988 #define CKM_DES_CBC_ENCRYPT_DATA 0x00001101
989 #define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102
990 #define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103
991 #define CKM_AES_ECB_ENCRYPT_DATA 0x00001104
992 #define CKM_AES_CBC_ENCRYPT_DATA 0x00001105
994 #define CKM_DSA_PARAMETER_GEN 0x00002000
995 #define CKM_DH_PKCS_PARAMETER_GEN 0x00002001
996 #define CKM_X9_42_DH_PARAMETER_GEN 0x00002002
998 #define CKM_VENDOR_DEFINED 0x80000000
1000 typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR
;
1003 /* CK_MECHANISM is a structure that specifies a particular
1005 typedef struct CK_MECHANISM
{
1006 CK_MECHANISM_TYPE mechanism
;
1007 CK_VOID_PTR pParameter
;
1009 /* ulParameterLen was changed from CK_USHORT to CK_ULONG for
1011 CK_ULONG ulParameterLen
; /* in bytes */
1014 typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR
;
1017 /* CK_MECHANISM_INFO provides information about a particular
1019 typedef struct CK_MECHANISM_INFO
{
1020 CK_ULONG ulMinKeySize
;
1021 CK_ULONG ulMaxKeySize
;
1023 } CK_MECHANISM_INFO
;
1025 /* The flags are defined as follows:
1026 * Bit Flag Mask Meaning */
1027 #define CKF_HW 0x00000001 /* performed by HW */
1029 /* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN,
1030 * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER,
1031 * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP,
1032 * and CKF_DERIVE are new for v2.0. They specify whether or not
1033 * a mechanism can be used for a particular task */
1034 #define CKF_ENCRYPT 0x00000100
1035 #define CKF_DECRYPT 0x00000200
1036 #define CKF_DIGEST 0x00000400
1037 #define CKF_SIGN 0x00000800
1038 #define CKF_SIGN_RECOVER 0x00001000
1039 #define CKF_VERIFY 0x00002000
1040 #define CKF_VERIFY_RECOVER 0x00004000
1041 #define CKF_GENERATE 0x00008000
1042 #define CKF_GENERATE_KEY_PAIR 0x00010000
1043 #define CKF_WRAP 0x00020000
1044 #define CKF_UNWRAP 0x00040000
1045 #define CKF_DERIVE 0x00080000
1047 /* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE,
1048 * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They
1049 * describe a token's EC capabilities not available in mechanism
1051 #define CKF_EC_F_P 0x00100000
1052 #define CKF_EC_F_2M 0x00200000
1053 #define CKF_EC_ECPARAMETERS 0x00400000
1054 #define CKF_EC_NAMEDCURVE 0x00800000
1055 #define CKF_EC_UNCOMPRESS 0x01000000
1056 #define CKF_EC_COMPRESS 0x02000000
1058 #define CKF_EXTENSION 0x80000000 /* FALSE for this version */
1060 typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR
;
1063 /* CK_RV is a value that identifies the return value of a
1064 * Cryptoki function */
1065 /* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */
1066 typedef CK_ULONG CK_RV
;
1068 #define CKR_OK 0x00000000
1069 #define CKR_CANCEL 0x00000001
1070 #define CKR_HOST_MEMORY 0x00000002
1071 #define CKR_SLOT_ID_INVALID 0x00000003
1073 /* CKR_FLAGS_INVALID was removed for v2.0 */
1075 /* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */
1076 #define CKR_GENERAL_ERROR 0x00000005
1077 #define CKR_FUNCTION_FAILED 0x00000006
1079 /* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS,
1080 * and CKR_CANT_LOCK are new for v2.01 */
1081 #define CKR_ARGUMENTS_BAD 0x00000007
1082 #define CKR_NO_EVENT 0x00000008
1083 #define CKR_NEED_TO_CREATE_THREADS 0x00000009
1084 #define CKR_CANT_LOCK 0x0000000A
1086 #define CKR_ATTRIBUTE_READ_ONLY 0x00000010
1087 #define CKR_ATTRIBUTE_SENSITIVE 0x00000011
1088 #define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012
1089 #define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013
1090 #define CKR_DATA_INVALID 0x00000020
1091 #define CKR_DATA_LEN_RANGE 0x00000021
1092 #define CKR_DEVICE_ERROR 0x00000030
1093 #define CKR_DEVICE_MEMORY 0x00000031
1094 #define CKR_DEVICE_REMOVED 0x00000032
1095 #define CKR_ENCRYPTED_DATA_INVALID 0x00000040
1096 #define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041
1097 #define CKR_FUNCTION_CANCELED 0x00000050
1098 #define CKR_FUNCTION_NOT_PARALLEL 0x00000051
1100 /* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */
1101 #define CKR_FUNCTION_NOT_SUPPORTED 0x00000054
1103 #define CKR_KEY_HANDLE_INVALID 0x00000060
1105 /* CKR_KEY_SENSITIVE was removed for v2.0 */
1107 #define CKR_KEY_SIZE_RANGE 0x00000062
1108 #define CKR_KEY_TYPE_INCONSISTENT 0x00000063
1110 /* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED,
1111 * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED,
1112 * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for
1114 #define CKR_KEY_NOT_NEEDED 0x00000064
1115 #define CKR_KEY_CHANGED 0x00000065
1116 #define CKR_KEY_NEEDED 0x00000066
1117 #define CKR_KEY_INDIGESTIBLE 0x00000067
1118 #define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068
1119 #define CKR_KEY_NOT_WRAPPABLE 0x00000069
1120 #define CKR_KEY_UNEXTRACTABLE 0x0000006A
1122 #define CKR_MECHANISM_INVALID 0x00000070
1123 #define CKR_MECHANISM_PARAM_INVALID 0x00000071
1125 /* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID
1126 * were removed for v2.0 */
1127 #define CKR_OBJECT_HANDLE_INVALID 0x00000082
1128 #define CKR_OPERATION_ACTIVE 0x00000090
1129 #define CKR_OPERATION_NOT_INITIALIZED 0x00000091
1130 #define CKR_PIN_INCORRECT 0x000000A0
1131 #define CKR_PIN_INVALID 0x000000A1
1132 #define CKR_PIN_LEN_RANGE 0x000000A2
1134 /* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */
1135 #define CKR_PIN_EXPIRED 0x000000A3
1136 #define CKR_PIN_LOCKED 0x000000A4
1138 #define CKR_SESSION_CLOSED 0x000000B0
1139 #define CKR_SESSION_COUNT 0x000000B1
1140 #define CKR_SESSION_HANDLE_INVALID 0x000000B3
1141 #define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4
1142 #define CKR_SESSION_READ_ONLY 0x000000B5
1143 #define CKR_SESSION_EXISTS 0x000000B6
1145 /* CKR_SESSION_READ_ONLY_EXISTS and
1146 * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */
1147 #define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7
1148 #define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8
1150 #define CKR_SIGNATURE_INVALID 0x000000C0
1151 #define CKR_SIGNATURE_LEN_RANGE 0x000000C1
1152 #define CKR_TEMPLATE_INCOMPLETE 0x000000D0
1153 #define CKR_TEMPLATE_INCONSISTENT 0x000000D1
1154 #define CKR_TOKEN_NOT_PRESENT 0x000000E0
1155 #define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1
1156 #define CKR_TOKEN_WRITE_PROTECTED 0x000000E2
1157 #define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0
1158 #define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1
1159 #define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2
1160 #define CKR_USER_ALREADY_LOGGED_IN 0x00000100
1161 #define CKR_USER_NOT_LOGGED_IN 0x00000101
1162 #define CKR_USER_PIN_NOT_INITIALIZED 0x00000102
1163 #define CKR_USER_TYPE_INVALID 0x00000103
1165 /* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES
1166 * are new to v2.01 */
1167 #define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104
1168 #define CKR_USER_TOO_MANY_TYPES 0x00000105
1170 #define CKR_WRAPPED_KEY_INVALID 0x00000110
1171 #define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112
1172 #define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113
1173 #define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114
1174 #define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115
1175 #define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120
1177 /* These are new to v2.0 */
1178 #define CKR_RANDOM_NO_RNG 0x00000121
1180 /* These are new to v2.11 */
1181 #define CKR_DOMAIN_PARAMS_INVALID 0x00000130
1183 /* These are new to v2.0 */
1184 #define CKR_BUFFER_TOO_SMALL 0x00000150
1185 #define CKR_SAVED_STATE_INVALID 0x00000160
1186 #define CKR_INFORMATION_SENSITIVE 0x00000170
1187 #define CKR_STATE_UNSAVEABLE 0x00000180
1189 /* These are new to v2.01 */
1190 #define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190
1191 #define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191
1192 #define CKR_MUTEX_BAD 0x000001A0
1193 #define CKR_MUTEX_NOT_LOCKED 0x000001A1
1195 /* The following return values are new for PKCS #11 v2.20 amendment 3 */
1196 #define CKR_NEW_PIN_MODE 0x000001B0
1197 #define CKR_NEXT_OTP 0x000001B1
1199 /* This is new to v2.20 */
1200 #define CKR_FUNCTION_REJECTED 0x00000200
1202 #define CKR_VENDOR_DEFINED 0x80000000
1205 /* CK_NOTIFY is an application callback that processes events */
1206 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_NOTIFY
)(
1207 CK_SESSION_HANDLE hSession
, /* the session's handle */
1208 CK_NOTIFICATION event
,
1209 CK_VOID_PTR pApplication
/* passed to C_OpenSession */
1213 /* CK_FUNCTION_LIST is a structure holding a Cryptoki spec
1214 * version and pointers of appropriate types to all the
1215 * Cryptoki functions */
1216 /* CK_FUNCTION_LIST is new for v2.0 */
1217 typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST
;
1219 typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR
;
1221 typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR
;
1224 /* CK_CREATEMUTEX is an application callback for creating a
1226 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_CREATEMUTEX
)(
1227 CK_VOID_PTR_PTR ppMutex
/* location to receive ptr to mutex */
1231 /* CK_DESTROYMUTEX is an application callback for destroying a
1233 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_DESTROYMUTEX
)(
1234 CK_VOID_PTR pMutex
/* pointer to mutex */
1238 /* CK_LOCKMUTEX is an application callback for locking a mutex */
1239 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_LOCKMUTEX
)(
1240 CK_VOID_PTR pMutex
/* pointer to mutex */
1244 /* CK_UNLOCKMUTEX is an application callback for unlocking a
1246 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_UNLOCKMUTEX
)(
1247 CK_VOID_PTR pMutex
/* pointer to mutex */
1251 /* CK_C_INITIALIZE_ARGS provides the optional arguments to
1253 typedef struct CK_C_INITIALIZE_ARGS
{
1254 CK_CREATEMUTEX CreateMutex
;
1255 CK_DESTROYMUTEX DestroyMutex
;
1256 CK_LOCKMUTEX LockMutex
;
1257 CK_UNLOCKMUTEX UnlockMutex
;
1259 CK_VOID_PTR pReserved
;
1260 } CK_C_INITIALIZE_ARGS
;
1262 /* flags: bit flags that provide capabilities of the slot
1263 * Bit Flag Mask Meaning
1265 #define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001
1266 #define CKF_OS_LOCKING_OK 0x00000002
1268 typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR
;
1271 /* additional flags for parameters to functions */
1273 /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */
1274 #define CKF_DONT_BLOCK 1
1276 /* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10.
1277 * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message
1278 * Generation Function (MGF) applied to a message block when
1279 * formatting a message block for the PKCS #1 OAEP encryption
1281 typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE
;
1283 typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR
;
1285 /* The following MGFs are defined */
1286 /* CKG_MGF1_SHA256, CKG_MGF1_SHA384, and CKG_MGF1_SHA512
1287 * are new for v2.20 */
1288 #define CKG_MGF1_SHA1 0x00000001
1289 #define CKG_MGF1_SHA256 0x00000002
1290 #define CKG_MGF1_SHA384 0x00000003
1291 #define CKG_MGF1_SHA512 0x00000004
1292 /* SHA-224 is new for PKCS #11 v2.20 amendment 3 */
1293 #define CKG_MGF1_SHA224 0x00000005
1295 /* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10.
1296 * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source
1297 * of the encoding parameter when formatting a message block
1298 * for the PKCS #1 OAEP encryption scheme. */
1299 typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE
;
1301 typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR
;
1303 /* The following encoding parameter sources are defined */
1304 #define CKZ_DATA_SPECIFIED 0x00000001
1306 /* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10.
1307 * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the
1308 * CKM_RSA_PKCS_OAEP mechanism. */
1309 typedef struct CK_RSA_PKCS_OAEP_PARAMS
{
1310 CK_MECHANISM_TYPE hashAlg
;
1311 CK_RSA_PKCS_MGF_TYPE mgf
;
1312 CK_RSA_PKCS_OAEP_SOURCE_TYPE source
;
1313 CK_VOID_PTR pSourceData
;
1314 CK_ULONG ulSourceDataLen
;
1315 } CK_RSA_PKCS_OAEP_PARAMS
;
1317 typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR
;
1319 /* CK_RSA_PKCS_PSS_PARAMS is new for v2.11.
1320 * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the
1321 * CKM_RSA_PKCS_PSS mechanism(s). */
1322 typedef struct CK_RSA_PKCS_PSS_PARAMS
{
1323 CK_MECHANISM_TYPE hashAlg
;
1324 CK_RSA_PKCS_MGF_TYPE mgf
;
1326 } CK_RSA_PKCS_PSS_PARAMS
;
1328 typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR
;
1330 /* CK_EC_KDF_TYPE is new for v2.11. */
1331 typedef CK_ULONG CK_EC_KDF_TYPE
;
1333 /* The following EC Key Derivation Functions are defined */
1334 #define CKD_NULL 0x00000001
1335 #define CKD_SHA1_KDF 0x00000002
1337 /* CK_ECDH1_DERIVE_PARAMS is new for v2.11.
1338 * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
1339 * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,
1340 * where each party contributes one key pair.
1342 typedef struct CK_ECDH1_DERIVE_PARAMS
{
1344 CK_ULONG ulSharedDataLen
;
1345 CK_BYTE_PTR pSharedData
;
1346 CK_ULONG ulPublicDataLen
;
1347 CK_BYTE_PTR pPublicData
;
1348 } CK_ECDH1_DERIVE_PARAMS
;
1350 typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR
;
1353 /* CK_ECDH2_DERIVE_PARAMS is new for v2.11.
1354 * CK_ECDH2_DERIVE_PARAMS provides the parameters to the
1355 * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */
1356 typedef struct CK_ECDH2_DERIVE_PARAMS
{
1358 CK_ULONG ulSharedDataLen
;
1359 CK_BYTE_PTR pSharedData
;
1360 CK_ULONG ulPublicDataLen
;
1361 CK_BYTE_PTR pPublicData
;
1362 CK_ULONG ulPrivateDataLen
;
1363 CK_OBJECT_HANDLE hPrivateData
;
1364 CK_ULONG ulPublicDataLen2
;
1365 CK_BYTE_PTR pPublicData2
;
1366 } CK_ECDH2_DERIVE_PARAMS
;
1368 typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR
;
1370 typedef struct CK_ECMQV_DERIVE_PARAMS
{
1372 CK_ULONG ulSharedDataLen
;
1373 CK_BYTE_PTR pSharedData
;
1374 CK_ULONG ulPublicDataLen
;
1375 CK_BYTE_PTR pPublicData
;
1376 CK_ULONG ulPrivateDataLen
;
1377 CK_OBJECT_HANDLE hPrivateData
;
1378 CK_ULONG ulPublicDataLen2
;
1379 CK_BYTE_PTR pPublicData2
;
1380 CK_OBJECT_HANDLE publicKey
;
1381 } CK_ECMQV_DERIVE_PARAMS
;
1383 typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR
;
1385 /* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the
1386 * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */
1387 typedef CK_ULONG CK_X9_42_DH_KDF_TYPE
;
1388 typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR
;
1390 /* The following X9.42 DH key derivation functions are defined
1391 (besides CKD_NULL already defined : */
1392 #define CKD_SHA1_KDF_ASN1 0x00000003
1393 #define CKD_SHA1_KDF_CONCATENATE 0x00000004
1395 /* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11.
1396 * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the
1397 * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party
1398 * contributes one key pair */
1399 typedef struct CK_X9_42_DH1_DERIVE_PARAMS
{
1400 CK_X9_42_DH_KDF_TYPE kdf
;
1401 CK_ULONG ulOtherInfoLen
;
1402 CK_BYTE_PTR pOtherInfo
;
1403 CK_ULONG ulPublicDataLen
;
1404 CK_BYTE_PTR pPublicData
;
1405 } CK_X9_42_DH1_DERIVE_PARAMS
;
1407 typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR
;
1409 /* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11.
1410 * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
1411 * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation
1412 * mechanisms, where each party contributes two key pairs */
1413 typedef struct CK_X9_42_DH2_DERIVE_PARAMS
{
1414 CK_X9_42_DH_KDF_TYPE kdf
;
1415 CK_ULONG ulOtherInfoLen
;
1416 CK_BYTE_PTR pOtherInfo
;
1417 CK_ULONG ulPublicDataLen
;
1418 CK_BYTE_PTR pPublicData
;
1419 CK_ULONG ulPrivateDataLen
;
1420 CK_OBJECT_HANDLE hPrivateData
;
1421 CK_ULONG ulPublicDataLen2
;
1422 CK_BYTE_PTR pPublicData2
;
1423 } CK_X9_42_DH2_DERIVE_PARAMS
;
1425 typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR
;
1427 typedef struct CK_X9_42_MQV_DERIVE_PARAMS
{
1428 CK_X9_42_DH_KDF_TYPE kdf
;
1429 CK_ULONG ulOtherInfoLen
;
1430 CK_BYTE_PTR pOtherInfo
;
1431 CK_ULONG ulPublicDataLen
;
1432 CK_BYTE_PTR pPublicData
;
1433 CK_ULONG ulPrivateDataLen
;
1434 CK_OBJECT_HANDLE hPrivateData
;
1435 CK_ULONG ulPublicDataLen2
;
1436 CK_BYTE_PTR pPublicData2
;
1437 CK_OBJECT_HANDLE publicKey
;
1438 } CK_X9_42_MQV_DERIVE_PARAMS
;
1440 typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR
;
1442 /* CK_KEA_DERIVE_PARAMS provides the parameters to the
1443 * CKM_KEA_DERIVE mechanism */
1444 /* CK_KEA_DERIVE_PARAMS is new for v2.0 */
1445 typedef struct CK_KEA_DERIVE_PARAMS
{
1447 CK_ULONG ulRandomLen
;
1448 CK_BYTE_PTR pRandomA
;
1449 CK_BYTE_PTR pRandomB
;
1450 CK_ULONG ulPublicDataLen
;
1451 CK_BYTE_PTR pPublicData
;
1452 } CK_KEA_DERIVE_PARAMS
;
1454 typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR
;
1457 /* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and
1458 * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just
1459 * holds the effective keysize */
1460 typedef CK_ULONG CK_RC2_PARAMS
;
1462 typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR
;
1465 /* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC
1467 typedef struct CK_RC2_CBC_PARAMS
{
1468 /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for
1470 CK_ULONG ulEffectiveBits
; /* effective bits (1-1024) */
1472 CK_BYTE iv
[8]; /* IV for CBC mode */
1473 } CK_RC2_CBC_PARAMS
;
1475 typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR
;
1478 /* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the
1479 * CKM_RC2_MAC_GENERAL mechanism */
1480 /* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */
1481 typedef struct CK_RC2_MAC_GENERAL_PARAMS
{
1482 CK_ULONG ulEffectiveBits
; /* effective bits (1-1024) */
1483 CK_ULONG ulMacLength
; /* Length of MAC in bytes */
1484 } CK_RC2_MAC_GENERAL_PARAMS
;
1486 typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \
1487 CK_RC2_MAC_GENERAL_PARAMS_PTR
;
1490 /* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and
1491 * CKM_RC5_MAC mechanisms */
1492 /* CK_RC5_PARAMS is new for v2.0 */
1493 typedef struct CK_RC5_PARAMS
{
1494 CK_ULONG ulWordsize
; /* wordsize in bits */
1495 CK_ULONG ulRounds
; /* number of rounds */
1498 typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR
;
1501 /* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC
1503 /* CK_RC5_CBC_PARAMS is new for v2.0 */
1504 typedef struct CK_RC5_CBC_PARAMS
{
1505 CK_ULONG ulWordsize
; /* wordsize in bits */
1506 CK_ULONG ulRounds
; /* number of rounds */
1507 CK_BYTE_PTR pIv
; /* pointer to IV */
1508 CK_ULONG ulIvLen
; /* length of IV in bytes */
1509 } CK_RC5_CBC_PARAMS
;
1511 typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR
;
1514 /* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the
1515 * CKM_RC5_MAC_GENERAL mechanism */
1516 /* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */
1517 typedef struct CK_RC5_MAC_GENERAL_PARAMS
{
1518 CK_ULONG ulWordsize
; /* wordsize in bits */
1519 CK_ULONG ulRounds
; /* number of rounds */
1520 CK_ULONG ulMacLength
; /* Length of MAC in bytes */
1521 } CK_RC5_MAC_GENERAL_PARAMS
;
1523 typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \
1524 CK_RC5_MAC_GENERAL_PARAMS_PTR
;
1527 /* CK_MAC_GENERAL_PARAMS provides the parameters to most block
1528 * ciphers' MAC_GENERAL mechanisms. Its value is the length of
1530 /* CK_MAC_GENERAL_PARAMS is new for v2.0 */
1531 typedef CK_ULONG CK_MAC_GENERAL_PARAMS
;
1533 typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR
;
1535 /* CK_DES/AES_ECB/CBC_ENCRYPT_DATA_PARAMS are new for v2.20 */
1536 typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS
{
1540 } CK_DES_CBC_ENCRYPT_DATA_PARAMS
;
1542 typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR
;
1544 typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS
{
1548 } CK_AES_CBC_ENCRYPT_DATA_PARAMS
;
1550 typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR
;
1552 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the
1553 * CKM_SKIPJACK_PRIVATE_WRAP mechanism */
1554 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */
1555 typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS
{
1556 CK_ULONG ulPasswordLen
;
1557 CK_BYTE_PTR pPassword
;
1558 CK_ULONG ulPublicDataLen
;
1559 CK_BYTE_PTR pPublicData
;
1560 CK_ULONG ulPAndGLen
;
1562 CK_ULONG ulRandomLen
;
1563 CK_BYTE_PTR pRandomA
;
1564 CK_BYTE_PTR pPrimeP
;
1566 CK_BYTE_PTR pSubprimeQ
;
1567 } CK_SKIPJACK_PRIVATE_WRAP_PARAMS
;
1569 typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \
1570 CK_SKIPJACK_PRIVATE_WRAP_PTR
;
1573 /* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the
1574 * CKM_SKIPJACK_RELAYX mechanism */
1575 /* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */
1576 typedef struct CK_SKIPJACK_RELAYX_PARAMS
{
1577 CK_ULONG ulOldWrappedXLen
;
1578 CK_BYTE_PTR pOldWrappedX
;
1579 CK_ULONG ulOldPasswordLen
;
1580 CK_BYTE_PTR pOldPassword
;
1581 CK_ULONG ulOldPublicDataLen
;
1582 CK_BYTE_PTR pOldPublicData
;
1583 CK_ULONG ulOldRandomLen
;
1584 CK_BYTE_PTR pOldRandomA
;
1585 CK_ULONG ulNewPasswordLen
;
1586 CK_BYTE_PTR pNewPassword
;
1587 CK_ULONG ulNewPublicDataLen
;
1588 CK_BYTE_PTR pNewPublicData
;
1589 CK_ULONG ulNewRandomLen
;
1590 CK_BYTE_PTR pNewRandomA
;
1591 } CK_SKIPJACK_RELAYX_PARAMS
;
1593 typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \
1594 CK_SKIPJACK_RELAYX_PARAMS_PTR
;
1597 typedef struct CK_PBE_PARAMS
{
1598 CK_BYTE_PTR pInitVector
;
1599 CK_UTF8CHAR_PTR pPassword
;
1600 CK_ULONG ulPasswordLen
;
1603 CK_ULONG ulIteration
;
1606 typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR
;
1609 /* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the
1610 * CKM_KEY_WRAP_SET_OAEP mechanism */
1611 /* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */
1612 typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS
{
1613 CK_BYTE bBC
; /* block contents byte */
1614 CK_BYTE_PTR pX
; /* extra data */
1615 CK_ULONG ulXLen
; /* length of extra data in bytes */
1616 } CK_KEY_WRAP_SET_OAEP_PARAMS
;
1618 typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \
1619 CK_KEY_WRAP_SET_OAEP_PARAMS_PTR
;
1622 typedef struct CK_SSL3_RANDOM_DATA
{
1623 CK_BYTE_PTR pClientRandom
;
1624 CK_ULONG ulClientRandomLen
;
1625 CK_BYTE_PTR pServerRandom
;
1626 CK_ULONG ulServerRandomLen
;
1627 } CK_SSL3_RANDOM_DATA
;
1630 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS
{
1631 CK_SSL3_RANDOM_DATA RandomInfo
;
1632 CK_VERSION_PTR pVersion
;
1633 } CK_SSL3_MASTER_KEY_DERIVE_PARAMS
;
1635 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1636 CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR
;
1639 typedef struct CK_SSL3_KEY_MAT_OUT
{
1640 CK_OBJECT_HANDLE hClientMacSecret
;
1641 CK_OBJECT_HANDLE hServerMacSecret
;
1642 CK_OBJECT_HANDLE hClientKey
;
1643 CK_OBJECT_HANDLE hServerKey
;
1644 CK_BYTE_PTR pIVClient
;
1645 CK_BYTE_PTR pIVServer
;
1646 } CK_SSL3_KEY_MAT_OUT
;
1648 typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR
;
1651 typedef struct CK_SSL3_KEY_MAT_PARAMS
{
1652 CK_ULONG ulMacSizeInBits
;
1653 CK_ULONG ulKeySizeInBits
;
1654 CK_ULONG ulIVSizeInBits
;
1656 CK_SSL3_RANDOM_DATA RandomInfo
;
1657 CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial
;
1658 } CK_SSL3_KEY_MAT_PARAMS
;
1660 typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR
;
1662 /* CK_TLS_PRF_PARAMS is new for version 2.20 */
1663 typedef struct CK_TLS_PRF_PARAMS
{
1667 CK_ULONG ulLabelLen
;
1668 CK_BYTE_PTR pOutput
;
1669 CK_ULONG_PTR pulOutputLen
;
1670 } CK_TLS_PRF_PARAMS
;
1672 typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR
;
1674 /* WTLS is new for version 2.20 */
1675 typedef struct CK_WTLS_RANDOM_DATA
{
1676 CK_BYTE_PTR pClientRandom
;
1677 CK_ULONG ulClientRandomLen
;
1678 CK_BYTE_PTR pServerRandom
;
1679 CK_ULONG ulServerRandomLen
;
1680 } CK_WTLS_RANDOM_DATA
;
1682 typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR
;
1684 typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS
{
1685 CK_MECHANISM_TYPE DigestMechanism
;
1686 CK_WTLS_RANDOM_DATA RandomInfo
;
1687 CK_BYTE_PTR pVersion
;
1688 } CK_WTLS_MASTER_KEY_DERIVE_PARAMS
;
1690 typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1691 CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR
;
1693 typedef struct CK_WTLS_PRF_PARAMS
{
1694 CK_MECHANISM_TYPE DigestMechanism
;
1698 CK_ULONG ulLabelLen
;
1699 CK_BYTE_PTR pOutput
;
1700 CK_ULONG_PTR pulOutputLen
;
1701 } CK_WTLS_PRF_PARAMS
;
1703 typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR
;
1705 typedef struct CK_WTLS_KEY_MAT_OUT
{
1706 CK_OBJECT_HANDLE hMacSecret
;
1707 CK_OBJECT_HANDLE hKey
;
1709 } CK_WTLS_KEY_MAT_OUT
;
1711 typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR
;
1713 typedef struct CK_WTLS_KEY_MAT_PARAMS
{
1714 CK_MECHANISM_TYPE DigestMechanism
;
1715 CK_ULONG ulMacSizeInBits
;
1716 CK_ULONG ulKeySizeInBits
;
1717 CK_ULONG ulIVSizeInBits
;
1718 CK_ULONG ulSequenceNumber
;
1720 CK_WTLS_RANDOM_DATA RandomInfo
;
1721 CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial
;
1722 } CK_WTLS_KEY_MAT_PARAMS
;
1724 typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR
;
1726 /* CMS is new for version 2.20 */
1727 typedef struct CK_CMS_SIG_PARAMS
{
1728 CK_OBJECT_HANDLE certificateHandle
;
1729 CK_MECHANISM_PTR pSigningMechanism
;
1730 CK_MECHANISM_PTR pDigestMechanism
;
1731 CK_UTF8CHAR_PTR pContentType
;
1732 CK_BYTE_PTR pRequestedAttributes
;
1733 CK_ULONG ulRequestedAttributesLen
;
1734 CK_BYTE_PTR pRequiredAttributes
;
1735 CK_ULONG ulRequiredAttributesLen
;
1736 } CK_CMS_SIG_PARAMS
;
1738 typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR
;
1740 typedef struct CK_KEY_DERIVATION_STRING_DATA
{
1743 } CK_KEY_DERIVATION_STRING_DATA
;
1745 typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \
1746 CK_KEY_DERIVATION_STRING_DATA_PTR
;
1749 /* The CK_EXTRACT_PARAMS is used for the
1750 * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit
1751 * of the base key should be used as the first bit of the
1753 /* CK_EXTRACT_PARAMS is new for v2.0 */
1754 typedef CK_ULONG CK_EXTRACT_PARAMS
;
1756 typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR
;
1758 /* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10.
1759 * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to
1760 * indicate the Pseudo-Random Function (PRF) used to generate
1761 * key bits using PKCS #5 PBKDF2. */
1762 typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
;
1764 typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR
;
1766 /* The following PRFs are defined in PKCS #5 v2.0. */
1767 #define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001
1770 /* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10.
1771 * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the
1772 * source of the salt value when deriving a key using PKCS #5
1774 typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE
;
1776 typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR
;
1778 /* The following salt value sources are defined in PKCS #5 v2.0. */
1779 #define CKZ_SALT_SPECIFIED 0x00000001
1781 /* CK_PKCS5_PBKD2_PARAMS is new for v2.10.
1782 * CK_PKCS5_PBKD2_PARAMS is a structure that provides the
1783 * parameters to the CKM_PKCS5_PBKD2 mechanism. */
1784 typedef struct CK_PKCS5_PBKD2_PARAMS
{
1785 CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource
;
1786 CK_VOID_PTR pSaltSourceData
;
1787 CK_ULONG ulSaltSourceDataLen
;
1788 CK_ULONG iterations
;
1789 CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf
;
1790 CK_VOID_PTR pPrfData
;
1791 CK_ULONG ulPrfDataLen
;
1792 CK_UTF8CHAR_PTR pPassword
;
1793 CK_ULONG_PTR ulPasswordLen
;
1794 } CK_PKCS5_PBKD2_PARAMS
;
1796 typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR
;
1798 /* All CK_OTP structs are new for PKCS #11 v2.20 amendment 3 */
1800 typedef CK_ULONG CK_OTP_PARAM_TYPE
;
1801 typedef CK_OTP_PARAM_TYPE CK_PARAM_TYPE
; /* B/w compatibility */
1803 typedef struct CK_OTP_PARAM
{
1804 CK_OTP_PARAM_TYPE type
;
1806 CK_ULONG ulValueLen
;
1809 typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR
;
1811 typedef struct CK_OTP_PARAMS
{
1812 CK_OTP_PARAM_PTR pParams
;
1816 typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR
;
1818 typedef struct CK_OTP_SIGNATURE_INFO
{
1819 CK_OTP_PARAM_PTR pParams
;
1821 } CK_OTP_SIGNATURE_INFO
;
1823 typedef CK_OTP_SIGNATURE_INFO CK_PTR CK_OTP_SIGNATURE_INFO_PTR
;
1825 /* The following OTP-related defines are new for PKCS #11 v2.20 amendment 1 */
1826 #define CK_OTP_VALUE 0
1827 #define CK_OTP_PIN 1
1828 #define CK_OTP_CHALLENGE 2
1829 #define CK_OTP_TIME 3
1830 #define CK_OTP_COUNTER 4
1831 #define CK_OTP_FLAGS 5
1832 #define CK_OTP_OUTPUT_LENGTH 6
1833 #define CK_OTP_OUTPUT_FORMAT 7
1835 /* The following OTP-related defines are new for PKCS #11 v2.20 amendment 1 */
1836 #define CKF_NEXT_OTP 0x00000001
1837 #define CKF_EXCLUDE_TIME 0x00000002
1838 #define CKF_EXCLUDE_COUNTER 0x00000004
1839 #define CKF_EXCLUDE_CHALLENGE 0x00000008
1840 #define CKF_EXCLUDE_PIN 0x00000010
1841 #define CKF_USER_FRIENDLY_OTP 0x00000020
1843 /* CK_KIP_PARAMS is new for PKCS #11 v2.20 amendment 2 */
1844 typedef struct CK_KIP_PARAMS
{
1845 CK_MECHANISM_PTR pMechanism
;
1846 CK_OBJECT_HANDLE hKey
;
1851 typedef CK_KIP_PARAMS CK_PTR CK_KIP_PARAMS_PTR
;
1853 /* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
1854 typedef struct CK_AES_CTR_PARAMS
{
1855 CK_ULONG ulCounterBits
;
1857 } CK_AES_CTR_PARAMS
;
1859 typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR
;
1861 /* CK_CAMELLIA_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
1862 typedef struct CK_CAMELLIA_CTR_PARAMS
{
1863 CK_ULONG ulCounterBits
;
1865 } CK_CAMELLIA_CTR_PARAMS
;
1867 typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR
;
1869 /* CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */
1870 typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS
{
1874 } CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS
;
1876 typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR
;
1878 /* CK_ARIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */
1879 typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS
{
1883 } CK_ARIA_CBC_ENCRYPT_DATA_PARAMS
;
1885 typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR
;