Debian Codegraph @

man/man1/p11sak.1.in

raw
1 .TH P11SAK 1 "May 2025" "@PACKAGE_VERSION@" "openCryptoki"
2 .SH NAME
3 p11sak \- Manage token keys in a PKCS\~#11 token repository.
4 .
5 .
6 .
7 .SH SYNOPSIS
8 .B p11sak
9 .I command
10 .RB [ ARGUMENTS ]
11 .RB [ OPTIONS ]
12 .PP
13 .
14 .B p11sak
15 .BR \-\-help | \-h
16 .br
17 .B p11sak
18 .BR \-\-version | \-v
19 .
20 .
21 .
22 .SH DESCRIPTION
23 The \fBp11sak\fP tool can be used to manage token keys and certificates in a
24 PKCS\~#11 token repository. The utility provides a flexible key management tool
25 to generate, list, remove, update, copy, import, and export symmetric (DES,
26 3DES, generic, SHA\-HMAC, AES, AES\-XTS) and asymmetric (RSA, DH, DSA, EC,
27 EC\-Edwards, EC\-Montgomery, IBM Dilithium, IBM Kyber, IBM ML\-DSA,
28 IBM ML\-KEM, ML\-DSA, ML\-KEM) keys. This tool is also capable of listing the
29 keys with their PKCS\~#11 attributes and their values (not all attributes may
30 be displayed if a key is sensitive). It also supports the import, export, copy,
31 and listing of certificates. Public keys inside certificates and private keys
32 can be extracted and added to the token repository as new public key objects.
33
34 .PP
35 .B Note:
36 The
37 .B p11sak
38 tool only operates on token keys (i.e. \fBCKA_TOKEN=TRUE\fP), but not on
39 session keys (\fBCKA_TOKEN=FALSE\fP). Token keys are stored persistently in the
40 token's repository, while session keys are not stored persistently, and only
41 exist as long as the session is alive. Thus, session keys generated or imported
42 by the
43 .B p11sak
44 tool would not exist anymore when the
45 .B p11sak
46 tool has exited.
47 .
48 .
49 .
50 .SH COMMANDS
51 The \fBp11sak\fP tool supports various commands to generate, list, remove,
52 update, import, and export token keys and certificates in a PKCS\~#11 token
53 repository.
54 .PP
55 .SS "Generating symmetric and asymmetric keys"
56 .B p11sak
57 .BR generate\-key | gen\-key | gen
58 .I KEYTYPE
59 .RB [ ARGUMENTS ]
60 .RB [ OPTIONS ]
61 .PP
62 Use the
63 .BR generate\-key | gen\-key | gen
64 command to generate a token key of the specified
65 .I KEYTYPE
66 with the respective
67 .B ARGUMENTS
68 and
69 .BR OPTIONS .
70 Possible values for the
71 .I KEYTYPE
72 argument are:
73 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
74 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
75 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
76 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
77 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
78 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem .
79 See below for a detailed description of the arguments and options. The
80 .BR \-\-help | \-h
81 option also shows the arguments and options available.
82 .
83 .PP
84 .SS "Generating DES/3DES keys"
85 .
86 .B p11sak
87 .BR generate\-key | gen\-key | gen
88 .BR des | 3des
89 .BR \-\-slot | \-s
90 .I SLOTID
91 .RB [ \-\-pin | \-p
92 .IR PIN ]
93 .RB [ \-\-force\-pin\-prompt ]
94 .RB [ \-\-no\-login | \-N ]
95 .RB [ \-\-so ]
96 .BR \-\-label | \-L
97 .I LABEL
98 .BR \-\-attr | \-a
99 .I ATTRS
100 .RB [ \-\-id | \-i
101 .IR ID ]
102 .RB [ \-\-help | \-h ]
103 .PP
104 Use the
105 .BR generate\-key | gen\-key | gen
106 command with the
107 .B des|3des
108 .I KEYTYPE
109 argument to generate a DES or 3DES key (\fBCKK_DES\fP or \fBCKK_DES3\fP). The
110 .BR \-\-label | \-L
111 .I LABEL
112 option sets the
113 .B CKA_LABEL
114 attribute of the key and the
115 .BR \-\-attr | \-a
116 .I ATTRS
117 option can be used to set the boolean attributes of the key (see below for
118 detailed description of the attributes). The
119 .BR \-\-id | \-i
120 .I ID
121 option can be used to set the value of the
122 .B CKA_ID
123 attribute of the key.
124 .PP
125 .SS "Generating generic secret keys"
126 .
127 .B p11sak
128 .BR generate\-key | gen\-key | gen
129 .BR generic
130 .I KEYBITS
131 .BR \-\-slot | \-s
132 .I SLOTID
133 .RB [ \-\-pin | \-p
134 .IR PIN ]
135 .RB [ \-\-force\-pin\-prompt ]
136 .RB [ \-\-no\-login | \-N ]
137 .RB [ \-\-so ]
138 .BR \-\-label | \-L
139 .I LABEL
140 .BR \-\-attr | \-a
141 .I ATTRS
142 .RB [ \-\-id | \-i
143 .IR ID ]
144 .RB [ \-\-help | \-h ]
145 .PP
146 Use the
147 .BR generate\-key | gen\-key | gen
148 .B generic
149 .I KEYBITS
150 command and
151 .I KEYTYPE
152 argument to generate a generic secret key (\fBCKK_GENERIC_SECRET\fP) with the
153 key size in bits as specified by the
154 .I KEYBITS
155 argument. The
156 .BR \-\-label | \-L
157 .I LABEL
158 option sets the
159 .B CKA_LABEL
160 attribute of the key and the
161 .BR \-\-attr | \-a
162 .I ATTRS
163 option can be used to set the boolean attributes of the key (see below for
164 detailed description of the attributes). The
165 .BR \-\-id | \-i
166 .I ID
167 option can be used to set the value of the
168 .B CKA_ID
169 attribute of the key.
170 .
171 .PP
172 .SS "Generating SHA\-HMAC keys"
173 .
174 .B p11sak
175 .BR generate\-key | gen\-key | gen
176 .BR sha\-1\-hmac |\: sha224\-hmac |\: sha256\-hmac |\: sha384\-hmac |\: \
177 sha512\-hmac |\: sha512/224\-hmac |\: sha512/256\-hmac |\: sha3\-224\-hmac |\: \
178 sha3\-256\-hmac |\: sha3\-384\-hmac |\: sha3\-512\-hmac
179 .I KEYBITS
180 .BR \-\-slot | \-s
181 .I SLOTID
182 .RB [ \-\-pin | \-p
183 .IR PIN ]
184 .RB [ \-\-force\-pin\-prompt ]
185 .RB [ \-\-no\-login | \-N ]
186 .RB [ \-\-so ]
187 .BR \-\-label | \-L
188 .I LABEL
189 .BR \-\-attr | \-a
190 .I ATTRS
191 .RB [ \-\-id | \-i
192 .IR ID ]
193 .RB [ \-\-help | \-h ]
194 .PP
195 Use the
196 .BR generate\-key | gen\-key | gen
197 .B sha\fInnn\fB\-hmac
198 .I KEYBITS
199 command and
200 .I KEYTYPE
201 argument to generate a SHA\-HMAC key (\fBCKK_SHAnnn_HMAC\fP) with the
202 key size in bits as specified by the
203 .I KEYBITS
204 argument. The
205 .BR \-\-label | \-L
206 .I LABEL
207 option sets the
208 .B CKA_LABEL
209 attribute of the key and the
210 .BR \-\-attr | \-a
211 .I ATTRS
212 option can be used to set the boolean attributes of the key (see below for
213 detailed description of the attributes). The
214 .BR \-\-id | \-i
215 .I ID
216 option can be used to set the value of the
217 .B CKA_ID
218 attribute of the key.
219 .
220 .PP
221 .SS "Generating AES keys"
222 .
223 .B p11sak
224 .BR generate\-key | gen\-key | gen
225 .BR aes
226 .BR 128 | 192 | 256
227 .BR \-\-slot | \-s
228 .I SLOTID
229 .RB [ \-\-pin | \-p
230 .IR PIN ]
231 .RB [ \-\-force\-pin\-prompt ]
232 .RB [ \-\-no\-login | \-N ]
233 .RB [ \-\-so ]
234 .BR \-\-label | \-L
235 .I LABEL
236 .BR \-\-attr | \-a
237 .I ATTRS
238 .RB [ \-\-id | \-i
239 .IR ID ]
240 .RB [ \-\-help | \-h ]
241 .PP
242 Use the
243 .BR generate\-key | gen\-key | gen
244 .B aes
245 .B 128|192|256
246 command and
247 .I KEYTYPE
248 argument to generate a AES key (\fBCKK_AES\fP) with 128-, 192-, or 256-bit
249 length, respectively. The
250 .BR \-\-label | \-L
251 .I LABEL
252 option sets the
253 .B CKA_LABEL
254 attribute of the key and the
255 .BR \-\-attr | \-a
256 .I ATTRS
257 option can be used to set the boolean attributes of the key (see below for
258 detailed description of the attributes). The
259 .BR \-\-id | \-i
260 .I ID
261 option can be used to set the value of the
262 .B CKA_ID
263 attribute of the key.
264 .
265 .PP
266 .SS "Generating AES\-XTS keys"
267 .
268 .B p11sak
269 .BR generate\-key | gen\-key | gen
270 .BR aes\-xts
271 .BR 128 | 256
272 .BR \-\-slot | \-s
273 .I SLOTID
274 .RB [ \-\-pin | \-p
275 .IR PIN ]
276 .RB [ \-\-force\-pin\-prompt ]
277 .RB [ \-\-no\-login | \-N ]
278 .RB [ \-\-so ]
279 .BR \-\-label | \-L
280 .I LABEL
281 .BR \-\-attr | \-a
282 .I ATTRS
283 .RB [ \-\-id | \-i
284 .IR ID ]
285 .RB [ \-\-help | \-h ]
286 .PP
287 Use the
288 .BR generate\-key | gen\-key | gen
289 .B aes\-xts
290 .B 128|256
291 command and
292 .I KEYTYPE
293 argument to generate a AES\-XTS key (\fBCKK_AES_XTS\fP) with 128- or 256-bit
294 length, respectively. The
295 .BR \-\-label | \-L
296 .I LABEL
297 option sets the
298 .B CKA_LABEL
299 attribute of the key and the
300 .BR \-\-attr | \-a
301 .I ATTRS
302 option can be used to set the boolean attributes of the key (see below for
303 detailed description of the attributes). The
304 .BR \-\-id | \-i
305 .I ID
306 option can be used to set the value of the
307 .B CKA_ID
308 attribute of the key.
309 .
310 .PP
311 .SS "Generating RSA keys"
312 .
313 .B p11sak
314 .BR generate\-key | gen\-key | gen
315 .BR rsa
316 .I KEYBITS
317 .RI [ PUBL\-EXP ]
318 .BR \-\-slot | \-s
319 .I SLOTID
320 .RB [ \-\-pin | \-p
321 .IR PIN ]
322 .RB [ \-\-force\-pin\-prompt ]
323 .RB [ \-\-no\-login | \-N ]
324 .RB [ \-\-so ]
325 .BR \-\-label | \-L
326 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
327 .BR \-\-attr | \-a
328 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
329 .RB [ \-\-id | \-i
330 .IR ID ]
331 .RB [ \-\-help | \-h ]
332 .PP
333 Use the
334 .BR generate\-key | gen\-key | gen
335 .B rsa
336 .I KEYBITS
337 command and
338 .I KEYTYPE
339 argument to generate an RSA key (\fBCKK_RSA\fP) with the key size in bits as
340 specified by the
341 .I KEYBITS
342 argument. The key size must be from 512 to 16384 and a multiple of 8 bits.
343 Typical key sizes are 512, 1024, 2048, 4096, or 8192. Not all RSA key sizes
344 might be supported by all tokens. The
345 .BR \-\-label | \-L
346 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
347 option sets the
348 .B CKA_LABEL
349 attribute of the key and the
350 .BR \-\-attr | \-a
351 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
352 option can be used to set the boolean attributes of the key (see below for
353 detailed description of the attributes).
354 Optionally, set individual key attributes for public and private key separated
355 by a colon (\fB:\fP). The
356 .BR \-\-id | \-i
357 .I ID
358 option can be used to set the value of the
359 .B CKA_ID
360 attribute of the key. Furthermore, the optional
361 .I PUBL\-EXP
362 argument allows the user to specify the exponent used for generating the RSA
363 key. The default is set to 65537 according to the PKCS\~#11 standard.
364 .
365 .PP
366 .SS "Generating DH keys"
367 .
368 .B p11sak
369 .BR generate\-key | gen\-key | gen
370 .BR dh
371 .IR GROUP | DH\-PARAM\-PEM\-FILE
372 .RI [ PRIV\-BITS ]
373 .BR \-\-slot | \-s
374 .I SLOTID
375 .RB [ \-\-pin | \-p
376 .IR PIN ]
377 .RB [ \-\-force\-pin\-prompt ]
378 .RB [ \-\-no\-login | \-N ]
379 .RB [ \-\-so ]
380 .BR \-\-label | \-L
381 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
382 .BR \-\-attr | \-a
383 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
384 .RB [ \-\-id | \-i
385 .IR ID ]
386 .RB [ \-\-help | \-h ]
387 .PP
388 Use the
389 .BR generate\-key | gen\-key | gen
390 .B dh
391 .IR GROUP | DH\-PARAM\-PEM\-FILE
392 command and
393 .I KEYTYPE
394 argument to generate a DH key (\fBCKK_DH\fP), where
395 .I GROUP
396 specifies the Diffie\-Hellman FFC group name or
397 .I DH\-PARAM\-PEM\-FILE
398 specifies the name of a DH parameters PEM file.
399 The following arguments can be used for respective groups:
400 .BR ffdhe2048 |\: ffdhe3072 |\: ffdhe4096 |\: ffdhe6144 |\: ffdhe8192 |\: \
401 modp1536 |\: modp2048 |\: modp3072 |\: modp4096 |\: modp6144 |\: modp8192
402 .PP
403 .B Note:
404 Not all groups are supported by all tokens and key generation fails
405 when the specified
406 .I GROUP
407 is not supported. Also, not all groups are supported by all OpenSSL versions.
408 If the
409 .B p11sak
410 tool is compiled against an OpenSSL version that does not support certain
411 groups, then those groups are not accepted for the
412 .I GROUP
413 argument.
414 .PP
415 Alternatively, specify a DH parameters PEM file as
416 .I DH\-PARAM\-PEM\-FILE
417 argument. You can for example generate DH parameters using the
418 .B OpenSSL
419 command line tool as follows: '\fBopenssl dhparam <numbits> \-out <pem\-file>
420 \-outform PEM'\fP. See the OpenSSL man page for details about this command.
421 .PP
422 The
423 .BR \-\-label | \-L
424 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
425 option sets the
426 .B CKA_LABEL
427 attribute of the key and the
428 .BR \-\-attr | \-a
429 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
430 option can be used to set the boolean attributes of the key (see below for
431 detailed description of the attributes).
432 Optionally, set individual key attributes for public and private key separated
433 by a colon (\fB:\fP). The
434 .BR \-\-id | \-i
435 .I ID
436 option can be used to set the value of the
437 .B CKA_ID
438 attribute of the key. Furthermore, the optional
439 .I PRIV\-BITS
440 argument allows the user to specify the size of the private key in bits.
441 .
442 .PP
443 .SS "Generating DSA keys"
444 .
445 .B p11sak
446 .BR generate\-key | gen\-key | gen
447 .BR dsa
448 .I DSA\-PARAM\-PEM\-FILE
449 .BR \-\-slot | \-s
450 .I SLOTID
451 .RB [ \-\-pin | \-p
452 .IR PIN ]
453 .RB [ \-\-force\-pin\-prompt ]
454 .RB [ \-\-no\-login | \-N ]
455 .RB [ \-\-so ]
456 .BR \-\-label | \-L
457 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
458 .BR \-\-attr | \-a
459 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
460 .RB [ \-\-id | \-i
461 .IR ID ]
462 .RB [ \-\-help | \-h ]
463 .PP
464 Use the
465 .BR generate\-key | gen\-key | gen
466 .B dsa
467 .I DSA\-PARAM\-PEM\-FILE
468 command and
469 .I KEYTYPE
470 argument to generate a DSA key (\fBCKK_DSA\fP), where
471 .I DSA\-PARAM\-PEM\-FILE
472 specifies the name of a DSA parameters PEM file. You can for example generate
473 DSA parameters using the
474 .B OpenSSL
475 command line tool as follows: '\fBopenssl dsaparam <numbits> \-out <pem\-file>
476 \-outform PEM'\fP. See the OpenSSL man page for details about this command.
477 .PP
478 The
479 .BR \-\-label | \-L
480 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
481 option sets the
482 .B CKA_LABEL
483 attribute of the key and the
484 .BR \-\-attr | \-a
485 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
486 option can be used to set the boolean attributes of the key (see below for
487 detailed description of the attributes).
488 Optionally, set individual key attributes for public and private key separated
489 by a colon (\fB:\fP). The
490 .BR \-\-id | \-i
491 .I ID
492 option can be used to set the value of the
493 .B CKA_ID
494 attribute of the key.
495 .PP
496 .SS "Generating EC keys"
497 .
498 .B p11sak
499 .BR generate\-key | gen\-key | gen
500 .BR ec
501 .I CURVE
502 .BR \-\-slot | \-s
503 .I SLOTID
504 .RB [ \-\-pin | \-p
505 .IR PIN ]
506 .RB [ \-\-force\-pin\-prompt ]
507 .RB [ \-\-no\-login | \-N ]
508 .RB [ \-\-so ]
509 .BR \-\-label | \-L
510 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
511 .BR \-\-attr | \-a
512 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
513 .RB [ \-\-id | \-i
514 .IR ID ]
515 .RB [ \-\-help | \-h ]
516 .PP
517 Use the
518 .BR generate\-key | gen\-key | gen
519 .B ec
520 .I CURVE
521 command and
522 .I KEYTYPE
523 argument to generate an EC key (\fBCKK_EC\fP), where
524 .I CURVE
525 specifies the elliptic curve used to create the EC key. The following arguments
526 can be used for respective curves:
527 .BR prime256v1 |\: prime192 |\: secp224 |\: secp384r1 |\: secp521r1 |\: \
528 secp265k1 |\: brainpoolP160r1 |\: brainpoolP160t1 |\: brainpoolP192r1 |\: \
529 brainpoolP192t1 |\: brainpoolP224r1 |\: brainpoolP224t1 |\: brainpoolP256r1 \
530 |\: brainpoolP256t1 |\: brainpoolP320r1 |\: brainpoolP320t1 |\: \
531 brainpoolP384r1 |\: brainpoolP384t1 |\: brainpoolP512r1 |\: brainpoolP512t1 \
532 |\: curve25519 |\: curve448 |\: ed25519 |\: ed448 |\: bls12-381
533 Note that using an Edwards or Montgomery curve for the EC key type only works
534 for the EP11 token and produces a non-PKCS#11-standard EC key.
535 .PP
536 .B Note:
537 Not all curves will be supported by all tokens and key generation will fail
538 when the specified
539 .I CURVE
540 is not supported.
541 .PP
542 The
543 .BR \-\-label | \-L
544 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
545 option sets the
546 .B CKA_LABEL
547 attribute of the key and the
548 .BR \-\-attr | \-a
549 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
550 option can be used to set the boolean attributes of the key (see below for
551 detailed description of the attributes).
552 Optionally, set individual key attributes for public and private key separated
553 by a colon (\fB:\fP). The
554 .BR \-\-id | \-i
555 .I ID
556 option can be used to set the value of the
557 .B CKA_ID
558 attribute of the key.
559 .
560 .PP
561 .SS "Generating EC\-Edwards keys"
562 .
563 .B p11sak
564 .BR generate\-key | gen\-key | gen
565 .BR ec\-edwards
566 .I CURVE
567 .BR \-\-slot | \-s
568 .I SLOTID
569 .RB [ \-\-pin | \-p
570 .IR PIN ]
571 .RB [ \-\-force\-pin\-prompt ]
572 .RB [ \-\-no\-login | \-N ]
573 .RB [ \-\-so ]
574 .BR \-\-label | \-L
575 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
576 .BR \-\-attr | \-a
577 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
578 .RB [ \-\-id | \-i
579 .IR ID ]
580 .RB [ \-\-help | \-h ]
581 .PP
582 Use the
583 .BR generate\-key | gen\-key | gen
584 .B ec\-edwards
585 .I CURVE
586 command and
587 .I KEYTYPE
588 argument to generate an EC\-Edwards key (\fBCKK_EC_EDWARDS\fP), where
589 .I CURVE
590 specifies the edwards curve used to create the EC-Edwards key. The following
591 arguments can be used for respective curves:
592 .BR ed25519 |\: ed448 .
593 .PP
594 .B Note:
595 Not all curves will be supported by all tokens and key generation will fail
596 when the specified
597 .I CURVE
598 is not supported.
599 .PP
600 The
601 .BR \-\-label | \-L
602 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
603 option sets the
604 .B CKA_LABEL
605 attribute of the key and the
606 .BR \-\-attr | \-a
607 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
608 option can be used to set the boolean attributes of the key (see below for
609 detailed description of the attributes).
610 Optionally, set individual key attributes for public and private key separated
611 by a colon (\fB:\fP). The
612 .BR \-\-id | \-i
613 .I ID
614 option can be used to set the value of the
615 .B CKA_ID
616 attribute of the key.
617 .
618 .PP
619 .SS "Generating EC\-Montgomery keys"
620 .
621 .B p11sak
622 .BR generate\-key | gen\-key | gen
623 .BR ec\-montgomery
624 .I CURVE
625 .BR \-\-slot | \-s
626 .I SLOTID
627 .RB [ \-\-pin | \-p
628 .IR PIN ]
629 .RB [ \-\-force\-pin\-prompt ]
630 .RB [ \-\-no\-login | \-N ]
631 .RB [ \-\-so ]
632 .BR \-\-label | \-L
633 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
634 .BR \-\-attr | \-a
635 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
636 .RB [ \-\-id | \-i
637 .IR ID ]
638 .RB [ \-\-help | \-h ]
639 .PP
640 Use the
641 .BR generate\-key | gen\-key | gen
642 .B ec\-montgomery
643 .I CURVE
644 command and
645 .I KEYTYPE
646 argument to generate an EC\-Montgomery key (\fBCKK_EC_MONTGOMERY\fP), where
647 .I CURVE
648 specifies the montgomery curve used to create the EC\-Montgomery key. The
649 following arguments can be used for respective curves:
650 .BR curve25519 |\: curve448 .
651 .PP
652 .B Note:
653 Not all curves are supported by all tokens and key generation fails
654 when the specified
655 .I CURVE
656 is not supported.
657 .PP
658 The
659 .BR \-\-label | \-L
660 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
661 option sets the
662 .B CKA_LABEL
663 attribute of the key and the
664 .BR \-\-attr | \-a
665 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
666 option can be used to set the boolean attributes of the key (see below for
667 detailed description of the attributes).
668 Optionally, set individual key attributes for public and private key separated
669 by a colon (\fB:\fP). The
670 .BR \-\-id | \-i
671 .I ID
672 option can be used to set the value of the
673 .B CKA_ID
674 attribute of the key.
675 .
676 .PP
677 .SS "Generating IBM Dilithium keys"
678 .
679 .B p11sak
680 .BR generate\-key | gen\-key | gen
681 .BR ibm\-dilithium
682 .I VERSION
683 .BR \-\-slot | \-s
684 .I SLOTID
685 .RB [ \-\-pin | \-p
686 .IR PIN ]
687 .RB [ \-\-force\-pin\-prompt ]
688 .RB [ \-\-no\-login | \-N ]
689 .RB [ \-\-so ]
690 .BR \-\-label | \-L
691 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
692 .BR \-\-attr | \-a
693 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
694 .RB [ \-\-id | \-i
695 .IR ID ]
696 .RB [ \-\-help | \-h ]
697 .PP
698 Use the
699 .BR generate\-key | gen\-key | gen
700 .B ibm\-dilithium
701 .I VERSION
702 command and
703 .I KEYTYPE
704 argument to generate an IBM Dilithium key (\fBCKK_IBM_PQC_DILITHIUM\fP), where
705 .I VERSION
706 specifies the version of the IBM Dilithium keypair. The following arguments can
707 be used for respective keys:
708 .BR r2_65 |\: r2_87 |\: r3_44 |\: r3_65 |\: r3_87
709 .PP
710 .B Note:
711 Not all IBM Dilithium versions are supported by all tokens and key
712 generation fails when the specified
713 .I VERSION
714 is not supported.
715 .PP
716 The
717 .BR \-\-label | \-L
718 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
719 option sets the
720 .B CKA_LABEL
721 attribute of the key and the
722 .BR \-\-attr | \-a
723 .I ATTRS
724 can be used to set the boolean attributes of the key (see below for detailed
725 description of the attributes).
726 Optionally, set individual key attributes for public and private key separated
727 by a colon (\fB:\fP). The
728 .BR \-\-id | \-i
729 .I ID
730 option can be used to set the value of the
731 .B CKA_ID
732 attribute of the key.
733 .
734 .PP
735 .SS "Generating IBM Kyber keys"
736 .
737 .B p11sak
738 .BR generate\-key | gen\-key | gen
739 .BR ibm\-kyber
740 .I VERSION
741 .BR \-\-slot | \-s
742 .I SLOTID
743 .RB [ \-\-pin | \-p
744 .IR PIN ]
745 .RB [ \-\-force\-pin\-prompt ]
746 .RB [ \-\-no\-login | \-N ]
747 .RB [ \-\-so ]
748 .BR \-\-label | \-L
749 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
750 .BR \-\-attr | \-a
751 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
752 .RB [ \-\-id | \-i
753 .IR ID ]
754 .RB [ \-\-help | \-h ]
755 .PP
756 Use the
757 .BR generate\-key | gen\-key | gen
758 .B ibm\-kyber
759 .I VERSION
760 command and
761 .I KEYTYPE
762 argument to generate an IBM Kyber key (\fBCKK_IBM_PQC_KYBER\fP), where
763 .I VERSION
764 specifies the version of the IBM Kyber keypair. The following arguments can
765 be used for respective keys:
766 .BR r2_768 | r2_1024
767 .PP
768 .B Note:
769 Not all IBM Kyber versions are supported by all tokens and key
770 generation fails when the specified
771 .I VERSION
772 is not supported.
773 .PP
774 The
775 .BR \-\-label | \-L
776 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
777 option sets the
778 .B CKA_LABEL
779 attribute of the key and the
780 .BR \-\-attr | \-a
781 .I ATTRS
782 can be used to set the boolean attributes of the key (see below for detailed
783 description of the attributes).
784 Optionally, set individual key attributes for public and private key separated
785 by a colon (\fB:\fP). The
786 .BR \-\-id | \-i
787 .I ID
788 option can be used to set the value of the
789 .B CKA_ID
790 attribute of the key.
791 .
792 .PP
793 .SS "Generating IBM ML\-DSA keys"
794 .
795 .B p11sak
796 .BR generate\-key | gen\-key | gen
797 .BR ibm\-ml\-dsa
798 .I VERSION
799 .BR \-\-slot | \-s
800 .I SLOTID
801 .RB [ \-\-pin | \-p
802 .IR PIN ]
803 .RB [ \-\-force\-pin\-prompt ]
804 .RB [ \-\-no\-login | \-N ]
805 .RB [ \-\-so ]
806 .BR \-\-label | \-L
807 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
808 .BR \-\-attr | \-a
809 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
810 .RB [ \-\-id | \-i
811 .IR ID ]
812 .RB [ \-\-help | \-h ]
813 .PP
814 Use the
815 .BR generate\-key | gen\-key | gen
816 .B ibm\-ml\-dsa
817 .I VERSION
818 command and
819 .I KEYTYPE
820 argument to generate an IBM ML\-DSA key (\fBCKK_IBM_ML_DSA\fP), where
821 .I VERSION
822 specifies the version of the IBM ML\-DSA keypair. The following arguments can
823 be used for respective keys:
824 .BR 44 | 65 | 87
825 .PP
826 .B Note:
827 Not all IBM ML\-DSA versions will be supported by all tokens and key
828 generation will fail when the specified
829 .I VERSION
830 is not supported.
831 .PP
832 The
833 .BR \-\-label | \-L
834 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
835 option sets the
836 .B CKA_LABEL
837 attribute of the key and the
838 .BR \-\-attr | \-a
839 .I ATTRS
840 can be used to set the boolean attributes of the key (see below for detailed
841 description of the attributes).
842 Optionally, set individual key attributes for public and private key separated
843 by a colon (\fB:\fP). The
844 .BR \-\-id | \-i
845 .I ID
846 option can be used to set the value of the
847 .B CKA_ID
848 attribute of the key.
849 .
850 .PP
851 .SS "Generating IBM ML\-KEM keys"
852 .
853 .B p11sak
854 .BR generate\-key | gen\-key | gen
855 .BR ibm\-ml\-kem
856 .I VERSION
857 .BR \-\-slot | \-s
858 .I SLOTID
859 .RB [ \-\-pin | \-p
860 .IR PIN ]
861 .RB [ \-\-force\-pin\-prompt ]
862 .RB [ \-\-no\-login | \-N ]
863 .RB [ \-\-so ]
864 .BR \-\-label | \-L
865 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
866 .BR \-\-attr | \-a
867 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
868 .RB [ \-\-id | \-i
869 .IR ID ]
870 .RB [ \-\-help | \-h ]
871 .PP
872 Use the
873 .BR generate\-key | gen\-key | gen
874 .B ibm\-ml\-kem
875 .I VERSION
876 command and
877 .I KEYTYPE
878 argument to generate an IBM ML\-KEM key (\fBCKK_IBM_ML_KEM\fP), where
879 .I VERSION
880 specifies the version of the IBM ML\-KEM keypair. The following arguments can
881 be used for respective keys:
882 .BR 512 | 768 | 1024
883 .PP
884 .B Note:
885 Not all IBM ML\-KEM versions will be supported by all tokens and key
886 generation will fail when the specified
887 .I VERSION
888 is not supported.
889 .PP
890 The
891 .BR \-\-label | \-L
892 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
893 option sets the
894 .B CKA_LABEL
895 attribute of the key and the
896 .BR \-\-attr | \-a
897 .I ATTRS
898 can be used to set the boolean attributes of the key (see below for detailed
899 description of the attributes).
900 Optionally, set individual key attributes for public and private key separated
901 by a colon (\fB:\fP). The
902 .BR \-\-id | \-i
903 .I ID
904 option can be used to set the value of the
905 .B CKA_ID
906 attribute of the key.
907 .
908 .PP
909 .SS "Generating ML\-DSA keys"
910 .
911 .B p11sak
912 .BR generate\-key | gen\-key | gen
913 .BR ml\-dsa
914 .I VERSION
915 .BR \-\-slot | \-s
916 .I SLOTID
917 .RB [ \-\-pin | \-p
918 .IR PIN ]
919 .RB [ \-\-force\-pin\-prompt ]
920 .RB [ \-\-no\-login | \-N ]
921 .RB [ \-\-so ]
922 .BR \-\-label | \-L
923 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
924 .BR \-\-attr | \-a
925 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
926 .RB [ \-\-id | \-i
927 .IR ID ]
928 .RB [ \-\-help | \-h ]
929 .PP
930 Use the
931 .BR generate\-key | gen\-key | gen
932 .B ml\-dsa
933 .I VERSION
934 command and
935 .I KEYTYPE
936 argument to generate an ML\-DSA key (\fBCKK_ML_DSA\fP), where
937 .I VERSION
938 specifies the version of the ML\-DSA keypair. The following arguments can
939 be used for respective keys:
940 .BR 44 | 65 | 87
941 .PP
942 .B Note:
943 Not all ML\-DSA versions will be supported by all tokens and key
944 generation will fail when the specified
945 .I VERSION
946 is not supported.
947 .PP
948 The
949 .BR \-\-label | \-L
950 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
951 option sets the
952 .B CKA_LABEL
953 attribute of the key and the
954 .BR \-\-attr | \-a
955 .I ATTRS
956 can be used to set the boolean attributes of the key (see below for detailed
957 description of the attributes).
958 Optionally, set individual key attributes for public and private key separated
959 by a colon (\fB:\fP). The
960 .BR \-\-id | \-i
961 .I ID
962 option can be used to set the value of the
963 .B CKA_ID
964 attribute of the key.
965 .
966 .PP
967 .SS "Generating ML\-KEM keys"
968 .
969 .B p11sak
970 .BR generate\-key | gen\-key | gen
971 .BR ml\-kem
972 .I VERSION
973 .BR \-\-slot | \-s
974 .I SLOTID
975 .RB [ \-\-pin | \-p
976 .IR PIN ]
977 .RB [ \-\-force\-pin\-prompt ]
978 .RB [ \-\-no\-login | \-N ]
979 .RB [ \-\-so ]
980 .BR \-\-label | \-L
981 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
982 .BR \-\-attr | \-a
983 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
984 .RB [ \-\-id | \-i
985 .IR ID ]
986 .RB [ \-\-help | \-h ]
987 .PP
988 Use the
989 .BR generate\-key | gen\-key | gen
990 .B ml\-kem
991 .I VERSION
992 command and
993 .I KEYTYPE
994 argument to generate an ML\-KEM key (\fBCKK_ML_KEM\fP), where
995 .I VERSION
996 specifies the version of the ML\-KEM keypair. The following arguments can
997 be used for respective keys:
998 .BR 512 | 768 | 1024
999 .PP
1000 .B Note:
1001 Not all ML\-KEM versions will be supported by all tokens and key
1002 generation will fail when the specified
1003 .I VERSION
1004 is not supported.
1005 .PP
1006 The
1007 .BR \-\-label | \-L
1008 .IR LABEL | PUB\-LABEL : PRIV\-LABEL
1009 option sets the
1010 .B CKA_LABEL
1011 attribute of the key and the
1012 .BR \-\-attr | \-a
1013 .I ATTRS
1014 can be used to set the boolean attributes of the key (see below for detailed
1015 description of the attributes).
1016 Optionally, set individual key attributes for public and private key separated
1017 by a colon (\fB:\fP). The
1018 .BR \-\-id | \-i
1019 .I ID
1020 option can be used to set the value of the
1021 .B CKA_ID
1022 attribute of the key.
1023 .
1024 .PP
1025 .SS "Listing symmetric and asymmetric keys"
1026 .
1027 .B p11sak
1028 .BR list\-key | ls\-key | ls
1029 .RI [ KEYTYPE ]
1030 .BR \-\-slot | \-s
1031 .I SLOTID
1032 .RB [ \-\-pin | \-p
1033 .IR PIN ]
1034 .RB [ \-\-force\-pin\-prompt ]
1035 .RB [ \-\-no\-login | \-N ]
1036 .RB [ \-\-so ]
1037 .RB [ \-\-label | \-L
1038 .IR LABEL ]
1039 .RB [ \-\-id | \-i
1040 .IR ID ]
1041 .RB [ \-\-attr | \-a
1042 .IR ATTRS ]
1043 .RB [ \-\-long | \-l ]
1044 .RB [ \-\-detailed\-uri ]
1045 .RB [ \-\-hsm\-mkvp | \-m ]
1046 .RB [ \-\-ep11\-session\-id | \-e ]
1047 .RB [ \-\-sort | \-S
1048 .IR SORT\-SPEC ]
1049 .RB [ \-\-help | \-h ]
1050 .PP
1051 Use the
1052 .BR list\-key | ls\-key | ls
1053 command and the optional
1054 .I KEYTYPE
1055 argument to list symmetric or asymmetric keys. Public, private, secret, or all
1056 keys can also be listed irrespective of the key type.
1057 .PP
1058 Possible values for the
1059 .I KEYTYPE
1060 argument are:
1061 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1062 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1063 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1064 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1065 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1066 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
1067 |\: secret |\: all .
1068 If
1069 .I KEYTYPE
1070 is omitted, then all key types are listed.
1071 .PP
1072 Specify the
1073 .BR \-\-label | \-L
1074 .IR LABEL ,
1075 the
1076 .BR \-\-id | \-i
1077 .IR ID ,
1078 and/or the
1079 .BR \-\-attr | \-a
1080 .I ATTRS
1081 options to filter the list of keys to display. You can use wildcards (\fB*\fP
1082 and \fB?\fP) in the
1083 .I LABEL
1084 specification. To specify a wildcard character that should not be treated as a
1085 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1086 Also, a backslash character that should not be treated as an escape character
1087 must be escaped (\fB\e\e\fP).
1088 The
1089 .B ID
1090 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1091 .PP
1092 By default, the keys are listed in a short, tabular format showing only the
1093 boolean attributes, the key type (\fBCKA_KEY_TYPE\fP) and the key label
1094 (\fPCKA_LABEL\fP). The attributes are denoted using the same single letters
1095 as used with the
1096 .BR \-\-attr | \-a
1097 .IR ATTRS | PUB\-ATTRS : PRIV\-ATTRS
1098 option. When option
1099 .BR \-\-long | \-l
1100 is specified, the keys are listed in long format, displaying the values of all
1101 attributes defined for the key type, including non-boolean attributes.
1102 When option
1103 .BR \-\-hsm\-mkvp | \-m
1104 is specified, the HSM master key verification patterns (MKVPs) of the keys are
1105 displayed. This is only possible for secure key tokens, such as the CCA and EP11
1106 tokens.
1107 When option
1108 .BR \-\-ep11\-session\-id | \-e
1109 is specified, the EP11 session-IDs of the keys are displayed. This is only
1110 possible for EP11 tokens.
1111 .PP
1112 By default, the keys are displayed in the order as they are retrieved from the
1113 PKCS\~#11 implementation. To display the keys in a certain order, specify the
1114 .BR \-\-sort | \-S
1115 .I SORT\-SPEC
1116 option. You can sort the keys by label, key type, object class, and/or key size.
1117 For details, see the description of the
1118 .BR \-\-sort | \-S
1119 .I SORT\-SPEC
1120 option below.
1121 .
1122 .PP
1123 .SS "Deleting symmetric and asymmetric keys"
1124 .
1125 .B p11sak
1126 .BR remove\-key | rm\-key | rm
1127 .RI [ KEYTYPE ]
1128 .BR \-\-slot | \-s
1129 .I SLOTID
1130 .RB [ \-\-pin | \-p
1131 .IR PIN ]
1132 .RB [ \-\-force\-pin\-prompt ]
1133 .RB [ \-\-no\-login | \-N ]
1134 .RB [ \-\-so ]
1135 .RB [ \-\-label | \-L
1136 .IR LABEL ]
1137 .RB [ \-\-id | \-i
1138 .IR ID ]
1139 .RB [ \-\-attr | \-a
1140 .IR ATTRS ]
1141 .RB [ \-\-long | \-l ]
1142 .RB [ \-\-force | \-f ]
1143 .RB [ \-\-help | \-h ]
1144 .PP
1145 Use the
1146 .BR remove\-key | rm\-key | rm
1147 command and the optional
1148 .I KEYTYPE
1149 argument to remove symmetric or asymmetric keys. Public, private, secret, or all
1150 keys can also be selected for removal irrespective of the key type.
1151 .PP
1152 Possible values for the
1153 .I KEYTYPE
1154 argument are:
1155 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1156 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1157 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1158 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1159 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1160 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
1161 |\: secret |\: all .
1162 If
1163 .I KEYTYPE
1164 is omitted, then all key types are selected for removal.
1165 .PP
1166 Specify the
1167 .BR \-\-label | \-L
1168 .IR LABEL ,
1169 the
1170 .BR \-\-id | \-i
1171 .IR ID ,
1172 and/or the
1173 .BR \-\-attr | \-a
1174 .I ATTRS
1175 options to filter the list of keys to remove. You can use wildcards (\fB*\fP
1176 and \fB?\fP) in the
1177 .I LABEL
1178 specification. To specify a wildcard character that should not be treated as a
1179 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1180 Also, a backslash character that should not be treated as an escape character
1181 must be escaped (\fB\e\e\fP).
1182 The
1183 .B ID
1184 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1185 .PP
1186 The user is prompted to confirm the removal of the key. To suppress the
1187 prompt, use the
1188 .BR \-\-force | \-f
1189 option.
1190 .PP
1191 .
1192 .SS "Setting or updating attributes of symmetric and asymmetric keys"
1193 .
1194 .B p11sak
1195 .BR set\-key\-attr | set\-key | set
1196 .RI [ KEYTYPE ]
1197 .BR \-\-slot | \-s
1198 .I SLOTID
1199 .RB [ \-\-pin | \-p
1200 .IR PIN ]
1201 .RB [ \-\-force\-pin\-prompt ]
1202 .RB [ \-\-no\-login | \-N ]
1203 .RB [ \-\-so ]
1204 .RB [ \-\-label | \-L
1205 .IR LABEL ]
1206 .RB [ \-\-id | \-i
1207 .IR ID ]
1208 .RB [ \-\-attr | \-a
1209 .IR ATTRS ]
1210 .RB [ \-\-force | \-f ]
1211 .RB [ \-\-new\-attr | \-A
1212 .IR ATTRS ]
1213 .RB [ \-\-new\-label | \-l
1214 .IR LABEL ]
1215 .RB [ \-\-new\-id | \-I
1216 .IR ID ]
1217 .RB [ \-\-help | \-h ]
1218 .PP
1219 Use the
1220 .B set\-key\-attrs | set\-key | set
1221 command and the optional
1222 .I KEYTYPE
1223 argument to set or update boolean attributes of symmetric or asymmetric keys.
1224 Public, private, secret, or all keys can also be selected for updating
1225 irrespective of the key type.
1226 .PP
1227 Possible values for the
1228 .I KEYTYPE
1229 argument are:
1230 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1231 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1232 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1233 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1234 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1235 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
1236 |\: secret |\: all .
1237 If
1238 .I KEYTYPE
1239 is omitted, then all key types are selected for updating.
1240 .PP
1241 Specify the
1242 .BR \-\-label | \-L
1243 .IR LABEL ,
1244 the
1245 .BR \-\-id | \-i
1246 .IR ID ,
1247 and/or the
1248 .BR \-\-attr | \-a
1249 .I ATTRS
1250 options to filter the list of keys to set or update. You can use wildcards
1251 (\fB*\fP and \fB?\fP) in the
1252 .I LABEL
1253 specification. To specify a wildcard character that should not be treated as a
1254 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1255 Also, a backslash character that should not be treated as an escape character
1256 must be escaped (\fB\e\e\fP).
1257 The
1258 .B ID
1259 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1260 .PP
1261 Use the
1262 .BR \-\-new\-attr | \-A
1263 .I ATTRS
1264 option to specify the boolean attributes of the key you want to update (see
1265 below for detailed description of the attributes). Attributes that are not
1266 specified are not changed. Use the
1267 .BR \-\-new\-label | \-l
1268 .I LABEL
1269 option to specify the new label, or the
1270 .BR \-\-new\-id | \-I
1271 .I ID
1272 option to specify the new ID to set for the key. At least one of the
1273 .BR \-\-new\-attr | \-A
1274 .IR ATTRS ,
1275 .BR \-\-new\-label | \-l
1276 .IR LABEL ,
1277 or
1278 .BR \-\-new\-id | \-I
1279 .I ID
1280 options must be specified.
1281 .PP
1282 The user is prompted to confirm the updating of the key. To suppress the
1283 prompt, use the
1284 .BR \-\-force | \-f
1285 option.
1286 .PP
1287 .
1288 .SS "Coyping symmetric and asymmetric keys"
1289 .
1290 .B p11sak
1291 .BR copy\-key | copy | cp
1292 .RI [ KEYTYPE ]
1293 .BR \-\-slot | \-s
1294 .I SLOTID
1295 .RB [ \-\-pin | \-p
1296 .IR PIN ]
1297 .RB [ \-\-force\-pin\-prompt ]
1298 .RB [ \-\-no\-login | \-N ]
1299 .RB [ \-\-so ]
1300 .RB [ \-\-label | \-L
1301 .IR LABEL ]
1302 .RB [ \-\-id | \-i
1303 .IR ID ]
1304 .RB [ \-\-attr | \-a
1305 .IR ATTRS ]
1306 .RB [ \-\-force | \-f ]
1307 .RB [ \-\-new\-attr | \-A
1308 .IR ATTRS ]
1309 .RB [ \-\-new\-label | \-l
1310 .IR LABEL ]
1311 .RB [ \-\-new\-id | \-I
1312 .IR ID ]
1313 .RB [ \-\-help | \-h ]
1314 .PP
1315 Use the
1316 .B copy\-key | copy | cp
1317 command and the optional
1318 .I KEYTYPE
1319 argument to copy symmetric or asymmetric keys and optionally set or change
1320 boolean attributes, the label, or ID of the copied keys.
1321 Public, private, secret, or all keys can also be copied irrespective of the key
1322 type.
1323 .PP
1324 Possible values for the
1325 .I KEYTYPE
1326 argument are:
1327 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1328 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1329 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1330 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1331 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1332 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
1333 |\: secret |\: all .
1334 If
1335 .I KEYTYPE
1336 is omitted, then all key types are selected for copying.
1337 .PP
1338 Specify the
1339 .BR \-\-label | \-L
1340 .IR LABEL ,
1341 the
1342 .BR \-\-id | \-i
1343 .IR ID ,
1344 and/or the
1345 .BR \-\-attr | \-a
1346 .I ATTRS
1347 options to filter the list of keys to copy. You can use wildcards (\fB*\fP
1348 and \fB?\fP) in the
1349 .I LABEL
1350 specification. To specify a wildcard character that should not be treated as a
1351 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1352 Also, a backslash character that should not be treated as an escape character
1353 must be escaped (\fB\e\e\fP).
1354 The
1355 .B ID
1356 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1357 .PP
1358 Use the
1359 .BR \-\-new\-attr | \-A
1360 .I ATTRS
1361 option to specify the boolean attributes of the copied key you want to set or
1362 update (see below for detailed description of the attributes). Attributes that
1363 are not specified are not changed. Use the
1364 .BR \-\-new\-label | \-l
1365 .I LABEL
1366 option to specify the new label, or the
1367 .BR \-\-new\-id | \-I
1368 .I ID
1369 option to specify the new ID to set for the copied key.
1370 .PP
1371 The user is prompted to confirm the copying of the key. To suppress the
1372 prompt, use the
1373 .BR \-\-force | \-f
1374 option.
1375 .PP
1376 .
1377 .SS "Importing symmetric and asymmetric keys from a file"
1378 .
1379 .B p11sak
1380 .BR import\-key | import | imp
1381 .I KEYTYPE
1382 .RI [ KIND ]
1383 .BR \-\-slot | \-s
1384 .I SLOTID
1385 .RB [ \-\-pin | \-p
1386 .IR PIN ]
1387 .RB [ \-\-force\-pin\-prompt ]
1388 .RB [ \-\-no\-login | \-N ]
1389 .RB [ \-\-so ]
1390 .BR \-\-label | \-L
1391 .I LABEL
1392 .RB [ \-\-id | \-i
1393 .IR ID ]
1394 .RB [ \-\-force | \-f ]
1395 .RB [ \-\-attr | \-a
1396 .IR ATTRS ]
1397 .BR \-\-file | \-F
1398 .I FILENAME
1399 .RB [ \-\-pem\-password | \-P
1400 .IR PASSWORD ]
1401 .RB [ \-\-force\-pem\-pwd\-prompt ]
1402 .RB [ \-\-opaque | \-o ]
1403 .RB [ \-\-oqsprovider\-pem ]
1404 .RB [ \-\-help | \-h ]
1405 .PP
1406 Use the
1407 .BR import\-key | import | imp
1408 command and
1409 .I KEYTYPE
1410 argument to import an symmetric or asymmetric key from a file. When importing
1411 an asymmetric key, the
1412 .I KIND
1413 argument is required and specifies to either import a
1414 .B private
1415 or
1416 .B public
1417 key.
1418 .PP
1419 Possible values for the
1420 .I KEYTYPE
1421 argument are:
1422 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1423 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1424 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1425 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1426 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1427 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
1428 |\: secret |\: all .
1429 .PP
1430 The
1431 .BR \-\-label | \-L
1432 .IR LABEL
1433 option sets the
1434 .B CKA_LABEL
1435 attribute of the key and the
1436 .BR \-\-attr | \-a
1437 .I ATTRS
1438 can be used to set the boolean attributes of the key (see below for detailed
1439 description of the attributes). The
1440 .BR \-\-id | \-i
1441 .I ID
1442 option can be used to set the value of the
1443 .B CKA_ID
1444 attribute of the key.
1445 .PP
1446 The
1447 .BR \-\-file | \-F
1448 .I FILENAME
1449 option specifies the file name of the file that contains the key to be imported.
1450 For symmetric keys, this is a binary file containing the key material in clear.
1451 For asymmetric keys, this is an OpenSSL PEM file containing a public or private
1452 key.
1453 PEM files can optionally be password protected. Specify the PEM password
1454 with the
1455 .BR \-\-pem\-password | \-P
1456 .I PASSWORD
1457 option or environment variable
1458 .BR P11SAK_PEM_PASSWORD .
1459 If the PEM file is password protected, but no PEM password is specified, you
1460 are prompted for the PEM password.
1461 Specify the
1462 .BR \-\-opaque | \-o
1463 option to import an opaque secure key blob. Not all tokens support this.
1464 .PP
1465 Specify the
1466 .BR \-\-oqsprovider\-pem
1467 option when the key material in the PEM file is in the
1468 .B oqsprovider
1469 format. This option is only valid for the
1470 .B ibm\-dilithium
1471 keytype. PEM files in
1472 .B oqsprovider
1473 format are only supported when the
1474 .B oqsprovider
1475 from
1476 .B https://github.com/open\-quantum\-safe/oqs\-provider
1477 has been configured with OpenSSL 3.0 or later.
1478 This is an experimental feature, it may change in an incompatible way in the
1479 future!
1480 .
1481 .SS "Exporting symmetric and asymmetric keys to a file"
1482 .
1483 .B p11sak
1484 .BR export\-key | export | exp
1485 .RI [ KEYTYPE ]
1486 .BR \-\-slot | \-s
1487 .I SLOTID
1488 .RB [ \-\-pin | \-p
1489 .IR PIN ]
1490 .RB [ \-\-force\-pin\-prompt ]
1491 .RB [ \-\-no\-login | \-N ]
1492 .RB [ \-\-so ]
1493 .RB [ \-\-label | \-L
1494 .IR LABEL ]
1495 .RB [ \-\-id | \-i
1496 .IR ID ]
1497 .RB [ \-\-attr | \-a
1498 .IR ATTRS ]
1499 .RB [ \-\-force | \-f ]
1500 .BR \-\-file | \-F
1501 .I FILENAME
1502 .RB [ \-\-encrypted\-pem | \-e ]
1503 .RB [ \-\-pem\-password | \-P
1504 .IR PASSWORD ]
1505 .RB [ \-\-force\-pem\-pwd\-prompt ]
1506 .RB [ \-\-opaque | \-o ]
1507 .RB [ \-\-spki | \-S ]
1508 .RB [ \-\-uri\-pem | \-u ]
1509 .RB [ \-\-uri\-pin\-value ]
1510 .RB [ \-\-uri\-pin\-source
1511 .IR FILENAME ]
1512 .RB [ \-\-oqsprovider\-pem ]
1513 .RB [ \-\-help | \-h ]
1514 .PP
1515 Use the
1516 .BR export\-key | export | exp
1517 command and the optional
1518 .I KEYTYPE
1519 argument to export symmetric or asymmetric keys to a file.
1520 Public, private, secret, or all keys can also be selected for export
1521 irrespective of the key type.
1522 .PP
1523 Possible values for the
1524 .I KEYTYPE
1525 argument are:
1526 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1527 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1528 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1529 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1530 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1531 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
1532 |\: secret |\: all .
1533 If
1534 .I KEYTYPE
1535 is omitted, then all key types are selected for export.
1536 .PP
1537 Specify the
1538 .BR \-\-label | \-L
1539 .IR LABEL ,
1540 the
1541 .BR \-\-id | \-i
1542 .IR ID ,
1543 and/or the
1544 .BR \-\-attr | \-a
1545 .I ATTRS
1546 options to filter the list of keys to export. You can use wildcards (\fB*\fP
1547 and \fB?\fP) in the
1548 .I LABEL
1549 specification. To specify a wildcard character that should not be treated as a
1550 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1551 Also, a backslash character that should not be treated as an escape character
1552 must be escaped (\fB\e\e\fP).
1553 The
1554 .B ID
1555 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1556 .PP
1557 The
1558 .BR \-\-file | \-F
1559 .I FILENAME
1560 option specifies the file name of the file to which the keys to be exported are
1561 written to. For symmetric keys, this is a binary file where the key material in
1562 clear is written to. For asymmetric keys, this is an OpenSSL PEM file where the
1563 public or private keys are written to. If multiple asymmetric keys match the
1564 filter, the keys are appended to the PEM file specified with the
1565 .BR \-\-file | \-F
1566 .I FILENAME
1567 option. If multiple symmetric keys or a mixture of asymmetric and symmetric keys
1568 match the filter, you are prompted to confirm to overwrite the previously
1569 created file, unless the
1570 .BR \-\-force | \-f
1571 option is specified.
1572 .PP
1573 Private keys in PEM files can optionally be password protected. Specify the
1574 .BR \-\-encrypted\-pem | \-e
1575 option to encrypt the exported private keys using
1576 .B AES\-CBC
1577 and an
1578 .B AES 256
1579 bit key derived from a password via
1580 .BR PBKDF2 .
1581 Specify the PEM password with the
1582 .BR \-\-pem\-password | \-P
1583 .I PASSWORD
1584 option or environment variable
1585 .BR P11SAK_PEM_PASSWORD ,
1586 otherwise you are prompted for the PEM password.
1587 .PP
1588 Specify the
1589 .BR \-\-opaque | \-o
1590 option to export the opaque secure key blobs of the key. Not all tokens support
1591 this.
1592 .PP
1593 Specify the
1594 .BR \-\-spki | \-S
1595 option to export the Subject Public Key Info (SPKI) from the
1596 .B CKA_PUBLIC_KEY_INFO
1597 attribute of an asymmetric private key instead of its private key material.
1598 This option can only be used with private keys.
1599 .PP
1600 Specify the
1601 .BR \-\-oqsprovider\-pem
1602 option when the key material is to be exported in
1603 .B oqsprovider
1604 format into the PEM file. This option is only valid for the
1605 .B ibm\-dilithium
1606 keytype. PEM files in
1607 .B oqsprovider
1608 format are only supported when the
1609 .B oqsprovider
1610 from
1611 .B https://github.com/open\-quantum\-safe/oqs\-provider
1612 has been configured with OpenSSL 3.0 or later.
1613 This is an experimental feature, it may change in an incompatible way in the
1614 future!
1615 .PP
1616 .B Note:
1617 Not all keys can be exported, because its attribute setting may forbid
1618 to reveal the values of certain attributes. To allow exporting of a secret
1619 .RB ( CKO_SECRET_KEY )
1620 or private
1621 .RB ( CKO_PRIVATE_KEY )
1622 key, attribute
1623 .B CKA_SENSITIVE
1624 must be
1625 .B CK_FALSE
1626 and attribute
1627 .B CKA_EXTRACTABLE
1628 must be
1629 .BR CK_TRUE .
1630 Secret or private keys that contain an opaque secure key blob (attribute
1631 .BR CKA_IBM_OPAQUE )
1632 can also not be
1633 exported in clear, even if the attributes would allow it. For such keys only the
1634 opaque secure key blob can be exported by using the
1635 .BR \-\-opaque | \-o
1636 option.
1637 .PP
1638 Specify the
1639 .BR \-\-uri\-pem | \-u
1640 option to export the PKCS#11 URI of the key in PEM form instead of the key
1641 material. Such an URI-PEM file can then be used with the
1642 .B pkcs11\-provider
1643 from
1644 .BR https://github.com/latchset/pkcs11\-provider .
1645 By default, the PKCS#11 URI does not contain the PKCS#11 user pin.
1646 Specify option
1647 .B \-\-uri\-pin\-value
1648 to include the PKCS#11 user pin in the URI using the
1649 .B pin\-value
1650 query attribute. This reveals the PKCS#11 user pin in clear, use with care!
1651 Alternatively, specify option
1652 .B \-\-uri\-pin\-source
1653 .I FILENAME
1654 to include the
1655 .B pin\-source
1656 query attribute in the URI, referencing the file name specified with this
1657 option. The PKCS#11 user pin value is written into that file as part of the
1658 export operation. This reveals the PKCS#11 user pin in clear, use with care!
1659 Adjust the file permissions of the specified pin\-source file so that it can
1660 only be read by the desired user(s). By default the file permissions are set so
1661 that only the owner user can read and write that file, but no one else (i.e.
1662 0600).
1663 .
1664 .
1665 .
1666 .SS "Extracting the public key of private key objects"
1667 .
1668 .B p11sak
1669 .BR extract\-pubkey | extr\-pubkey | expub
1670 .RI [ KEYTYPE ]
1671 .BR \-\-slot | \-s
1672 .I SLOTID
1673 .RB [ \-\-pin | \-p
1674 .IR PIN ]
1675 .RB [ \-\-force\-pin\-prompt ]
1676 .RB [ \-\-no\-login | \-N ]
1677 .RB [ \-\-so ]
1678 .RB [ \-\-label | \-L
1679 .IR LABEL ]
1680 .RB [ \-\-id | \-i
1681 .IR ID ]
1682 .RB [ \-\-attr | \-a
1683 .IR ATTRS ]
1684 .RB [ \-\-new\-attr | \-A
1685 .IR ATTRS ]
1686 .RB [ \-\-new\-label | \-l
1687 .IR LABEL ]
1688 .RB [ \-\-new\-id | \-I
1689 .IR ID ]
1690 .RB [ \-\-force | \-f ]
1691 .RB [ \-\-help | \-h ]
1692 .PP
1693 Use the
1694 .BR extract\-pubkey | extr\-pubkey | expub
1695 command and the optional
1696 .I KEYTYPE
1697 argument to extract the public key from private key objects and save it
1698 as new token object.
1699 .PP
1700 Possible values for the
1701 .I KEYTYPE
1702 argument are:
1703 .BR rsa |\: dh |\: dsa |\: ec |\: ec\-edwards |\: ec\-montgomery |\: \
1704 ibm\-dilithium |\: ibm\-kyber |\: ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa \
1705 |\: ml\-kem |\: private |\: all .
1706 If
1707 .I KEYTYPE
1708 is omitted, then all private key types are selected for export.
1709 .PP
1710 Specify the
1711 .BR \-\-label | \-L
1712 .IR LABEL ,
1713 the
1714 .BR \-\-id | \-i
1715 .IR ID ,
1716 and/or the
1717 .BR \-\-attr | \-a
1718 .I ATTRS
1719 options to filter the private keys of which the public keys are to be extracted.
1720 You can use wildcards (\fB*\fP and \fB?\fP) in the
1721 .I LABEL
1722 specification. To specify a wildcard character that should not be treated as a
1723 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1724 Also, a backslash character that should not be treated as an escape character
1725 must be escaped (\fB\e\e\fP).
1726 The
1727 .B ID
1728 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1729 .PP
1730 Use the
1731 .BR \-\-new\-attr | \-A
1732 .I ATTRS
1733 option to specify the boolean attributes of the public key object you want to
1734 set (see below for detailed description of the attributes).
1735 Use the
1736 .BR \-\-new\-label | \-l
1737 .I LABEL
1738 option to specify the new label. If no new label is specified, the label of the
1739 public key object is derived from the private key label by appending
1740 .BR _pubkey .
1741 .PP
1742 Use the
1743 .BR \-\-new\-id | \-I
1744 .I ID
1745 option to set an ID for the extracted public key object.
1746 .PP
1747 The user is prompted to confirm the extraction of the public key from the
1748 private key objects. To suppress the prompt, use the
1749 .BR \-\-force | \-f
1750 option.
1751 .PP
1752 .
1753 .
1754 .
1755 .SS "Exporting a key by wrapping it with a key encrypting key"
1756 .
1757 .B p11sak
1758 .BR wrap\-key | wrap
1759 .I WRAP\-MECH
1760 .RI [ KEYTYPE ]
1761 .BR \-\-slot | \-s
1762 .I SLOTID
1763 .RB [ \-\-pin | \-p
1764 .IR PIN ]
1765 .RB [ \-\-force\-pin\-prompt ]
1766 .RB [ \-\-no\-login | \-N ]
1767 .RB [ \-\-so ]
1768 .RB [ \-\-kek\-label | \-K
1769 .IR LABEL ]
1770 .RB [ \-\-kek\-id | \-k
1771 .IR ID ]
1772 .RB [ \-\-label | \-L
1773 .IR LABEL ]
1774 .RB [ \-\-id | \-i
1775 .IR ID ]
1776 .RB [ \-\-attr | \-a
1777 .IR ATTRS ]
1778 .RB [ \-\-force | \-f ]
1779 .BR \-\-file | \-F
1780 .I FILENAME
1781 .RB [ \-\-raw | \-R ]
1782 .RB [ "options specific for"
1783 .IR WRAP\-MECH ]
1784 .RB [ \-\-help | \-h ]
1785 .PP
1786 Use the
1787 .BR wrap\-key | wrap
1788 command and the
1789 .I WRAP\-MECH
1790 argument to export symmetric or asymmetric keys by wrapping it with a key
1791 encrypting key. Dependent on the key wrapping mechanism, additional options
1792 may be supported to specify mechanism parameters. The optional
1793 .I KEYTYPE
1794 argument can be used to filter the list of keys to export by key type.
1795 Only private and secret keys can be wrapped. Possible values for the
1796 .I KEYTYPE
1797 argument are:
1798 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
1799 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
1800 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
1801 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
1802 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
1803 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: private |\: secret \
1804 |\: all .
1805 If
1806 .I KEYTYPE
1807 is omitted, then all key types are selected for wrapping.
1808 .PP
1809 Possible values for the
1810 .I WRAP\-MECH
1811 argument are:
1812 .IP "\(bu" 2
1813 .BR aes\-cbc\-pad :
1814 Use mechanism
1815 .B CKM_AES_CBC_PAD
1816 for key wrapping. Wrapping and unwrapping is done with an AES key. Use the
1817 .BR \-\-iv | \-I
1818 .I IV
1819 option to specify the initialization vector (IV) for the AES\-CBC operation.
1820 .IP "\(bu" 2
1821 .BR aeskw\-kwp :
1822 Use mechanism
1823 .B CKM_AES_KEY_WRAP_KWP
1824 for key wrapping. Wrapping and unwrapping is done with an AES key. Use the
1825 .BR \-\-iv | \-I
1826 .I IV
1827 option to specify the initialization vector (IV) for the AESKW\-KWP operation.
1828 .IP "\(bu" 2
1829 .BR aeskw\-pkcs7 :
1830 Use mechanism
1831 .B CKM_AES_KEY_WRAP_PKCS7
1832 for key wrapping. Wrapping and unwrapping is done with an AES key. Use the
1833 .BR \-\-iv | \-I
1834 .I IV
1835 option to specify the initialization vector (IV) for the AESKW\-PKCS7 operation.
1836 .IP "\(bu" 2
1837 .BR rsa\-pkcs :
1838 Use mechanism
1839 .B CKM_RSA_PKCS
1840 for key wrapping. Wrapping is done with an RSA public key, unwrapping is done
1841 with the corresponding RSA private key. Only keys whose key material size is
1842 up to the KEK's RSA modulus size minus 11 bytes can be wrapped with this
1843 mechanism.
1844 .IP "\(bu" 2
1845 .BR rsa\-oaep :
1846 Use mechanism
1847 .B CKM_RSA_PKCS_OAEP
1848 for key wrapping. Wrapping is done with an RSA public key, unwrapping is done
1849 with the corresponding RSA private key. Only keys whose key material size is
1850 up to the KEK's RSA modulus size minus 2 times the hash\-alg digest size bytes
1851 minus 2 bytes wrapped with this mechanism. Use the
1852 .BR \-\-hash\-alg
1853 .IR HASH\-ALG ,
1854 .BR \-\-mgf\-alg
1855 .IR MGF\-ALG ,
1856 and
1857 .B \-\-source\-data
1858 .IR SOURCE\-DATA ,
1859 options to specify the OAEP mechanism parameters.
1860 .IP "\(bu" 2
1861 .BR rsa\-aeskw :
1862 Use mechanism
1863 .B CKM_RSA_AES_KEY_WRAP
1864 for key wrapping. Wrapping is done with an RSA public key, unwrapping is done
1865 with the corresponding RSA private key. Use the
1866 .BR \-\-aes\-key\-size
1867 .I AES\-KEYBITS
1868 option to specify the key size of the temporary AES key, and the
1869 .BR \-\-hash\-alg
1870 .IR HASH\-ALG ,
1871 .BR \-\-mgf\-alg
1872 .IR MGF\-ALG ,
1873 and
1874 .B \-\-source\-data
1875 .IR SOURCE\-DATA ,
1876 options to specify the OAEP mechanism parameters.
1877 .IP "\(bu" 2
1878 .BR ecdh\-aeskw ,
1879 .BR ecdh\-cof\-aeskw ,
1880 and
1881 .BR ecdh\-x\-aeskw :
1882 Use mechanisms
1883 .BR CKM_ECDH_AES_KEY_WRAP ,
1884 .BR CKM_ECDH_COF_AES_KEY_WRAP ,
1885 and
1886 .B CKM_ECDH_X_AES_KEY_WRAP
1887 respectively for key wrapping. Wrapping is done with an EC or EC-Montgomery
1888 public key (for
1889 .BR ecdh\-aeskw ),
1890 an EC public key (for
1891 .BR ecdh\-cof\-aeskw ),
1892 or an EC-Montgomery public key (for
1893 .BR ecdh\-x\-aeskw ).
1894 Unwrapping is done with the corresponding EC or EC-Montgomery private key (for
1895 .BR ecdh\-aeskw ),
1896 an EC private key (for
1897 .BR ecdh\-cof\-aeskw ),
1898 or an EC-Montgomery private key (for
1899 .BR ecdh\-x\-aeskw ).
1900 Use the
1901 .BR \-\-aes\-key\-size
1902 .I AES\-KEYBITS
1903 option to specify the key size of the temporary AES key, and the
1904 .BR \-\-kdf\-alg
1905 .IR KDF\-ALG ,
1906 and
1907 .B \-\-shared\-data
1908 .IR SHARED\-DATA ,
1909 options to specify the ECDH mechanism parameters.
1910 .PP
1911 Specify the
1912 .BR \-\-kek\-label | \-K
1913 .IR LABEL ,
1914 and/or the
1915 .BR \-\-kek\-id | \-k
1916 .IR ID
1917 option to select the key encrypting key (KEK). Only keys with the right object
1918 class and key type that fit to the wrapping mechanism are selected. If
1919 multiple key objects match, you are prompted to confirm to use the desired
1920 key object. If the
1921 .BR \-\-force | \-f
1922 option is specified, then the first matching key object is used.
1923 You can use wildcards (\fB*\fP and \fB?\fP) in the
1924 .I LABEL
1925 specification. To specify a wildcard character that should not be treated as a
1926 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1927 Also, a backslash character that should not be treated as an escape character
1928 must be escaped (\fB\e\e\fP). The
1929 .B ID
1930 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1931 .PP
1932 Specify the
1933 .BR \-\-label | \-L
1934 .IR LABEL ,
1935 the
1936 .BR \-\-id | \-i
1937 .IR ID ,
1938 and/or the
1939 .BR \-\-attr | \-a
1940 .I ATTRS
1941 options to filter the list of keys to wrap. You can use wildcards (\fB*\fP
1942 and \fB?\fP) in the
1943 .I LABEL
1944 specification. To specify a wildcard character that should not be treated as a
1945 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
1946 Also, a backslash character that should not be treated as an escape character
1947 must be escaped (\fB\e\e\fP).
1948 The
1949 .B ID
1950 must be specified as hex string (not prefixed with 0x) of any number of bytes.
1951 .PP
1952 The
1953 .BR \-\-file | \-F
1954 .I FILENAME
1955 option specifies the file name of the file to which the wrapped key material is
1956 written to. By default this is a PEM file using a p11sak-specific type and a
1957 header that contains information about the wrapping mechanism and mechanism
1958 parameters (if any). If option
1959 .BR \-\-raw | \-R
1960 is specified then the file is a raw binary file and the raw wrapped key
1961 material is written to it. If multiple keys match the filter, the keys are
1962 appended to the PEM file specified with the
1963 .BR \-\-file | \-F
1964 .I FILENAME
1965 option. If option
1966 .BR \-\-raw | \-R
1967 is specified, and multiple keys match the filter, you are prompted to
1968 confirm to overwrite the previously created file, unless the
1969 .BR \-\-force | \-f
1970 option is specified.
1971 .PP
1972 .B Note:
1973 Not all keys can be wrapped, because its attribute setting may forbid
1974 to extract the key material. To allow exporting of a secret
1975 .RB ( CKO_SECRET_KEY )
1976 or private
1977 .RB ( CKO_PRIVATE_KEY )
1978 key, attribute
1979 .B CKA_EXTRACTABLE
1980 must be
1981 .BR CK_TRUE .
1982 A token may not support all wrapping mechanisms, nor all mechanism parameter
1983 combinations. Also, not all tokens may support to wrap all key types.
1984 Furthermore, a token might limit the support of wrapping a key with a weaker
1985 key encrypting key.
1986 .
1987 .
1988 .
1989 .SS "Importing a key by unwrapping it with a key encrypting key"
1990 .
1991 .B p11sak
1992 .BR unwrap\-key | unwrap
1993 .RI [ WRAP\-MECH ]
1994 .RI [ KEYTYPE ]
1995 .BR \-\-slot | \-s
1996 .I SLOTID
1997 .RB [ \-\-pin | \-p
1998 .IR PIN ]
1999 .RB [ \-\-force\-pin\-prompt ]
2000 .RB [ \-\-no\-login | \-N ]
2001 .RB [ \-\-so ]
2002 .RB [ \-\-kek\-label | \-K
2003 .IR LABEL ]
2004 .RB [ \-\-kek\-id | \-k
2005 .IR ID ]
2006 .RB [ \-\-label | \-L
2007 .IR LABEL ]
2008 .RB [ \-\-id | \-i
2009 .IR ID ]
2010 .RB [ \-\-attr | \-a
2011 .IR ATTRS ]
2012 .RB [ \-\-force | \-f ]
2013 .BR \-\-file | \-F
2014 .I FILENAME
2015 .RB [ \-\-raw | \-R ]
2016 .RB [ "options specific for"
2017 .IR WRAP\-MECH ]
2018 .RB [ \-\-help | \-h ]
2019 .PP
2020 Use the
2021 .BR unwrap\-key | unwrap
2022 command and the optional
2023 .I WRAP\-MECH
2024 and
2025 .I KEYTYPE
2026 arguments to import symmetric or asymmetric keys by unwrapping it with a key
2027 encrypting key. Dependent on the key wrapping mechanism, additional options
2028 may be supported to specify mechanism parameters. Only private and secret keys
2029 can be unwrapped.
2030 .PP
2031 Arguments
2032 .I WRAP\-MECH
2033 and
2034 .IR KEYTYPE ,
2035 as well as wrapping mechanism specific options to specify mechanism parameters
2036 are only required if the
2037 .BR \-\-raw | \-R
2038 option is specified. Otherwise this information is read from the PEM file
2039 specified with the
2040 .BR \-\-file | \-F
2041 .I FILENAME
2042 option.
2043 .PP
2044 Possible values for the
2045 .I WRAP\-MECH
2046 argument are:
2047 .IP "\(bu" 2
2048 .BR aes\-cbc\-pad :
2049 Use mechanism
2050 .B CKM_AES_CBC_PAD
2051 for key wrapping. Wrapping and unwrapping is done with an AES key. Use the
2052 .BR \-\-iv | \-I
2053 .I IV
2054 option to specify the initialization vector (IV) for the AES\-CBC operation.
2055 .IP "\(bu" 2
2056 .BR aeskw\-kwp :
2057 Use mechanism
2058 .B CKM_AES_KEY_WRAP_KWP
2059 for key wrapping. Wrapping and unwrapping is done with an AES key. Use the
2060 .BR \-\-iv | \-I
2061 .I IV
2062 option to specify the initialization vector (IV) for the AESKW\-KWP operation.
2063 .IP "\(bu" 2
2064 .BR aeskw\-pkcs7 :
2065 Use mechanism
2066 .B CKM_AES_KEY_WRAP_PKCS7
2067 for key wrapping. Wrapping and unwrapping is done with an AES key. Use the
2068 .BR \-\-iv | \-I
2069 .I IV
2070 option to specify the initialization vector (IV) for the AESKW\-PKCS7 operation.
2071 .IP "\(bu" 2
2072 .BR rsa\-pkcs :
2073 Use mechanism
2074 .B CKM_RSA_PKCS
2075 for key wrapping. Wrapping is done with an RSA public key, unwrapping is done
2076 with the corresponding RSA private key. Only keys whose key material size is
2077 up to the KEK's RSA modulus size minus 11 bytes can be wrapped with this
2078 mechanism.
2079 .IP "\(bu" 2
2080 .BR rsa\-oaep :
2081 Use mechanism
2082 .B CKM_RSA_PKCS_OAEP
2083 for key wrapping. Wrapping is done with an RSA public key, unwrapping is done
2084 with the corresponding RSA private key. Only keys whose key material size is
2085 up to the KEK's RSA modulus size minus 2 times the hash\-alg digest size bytes
2086 minus 2 bytes wrapped with this mechanism. Use the
2087 .BR \-\-hash\-alg
2088 .IR HASH\-ALG ,
2089 .BR \-\-mgf\-alg
2090 .IR MGF\-ALG ,
2091 and
2092 .B \-\-source\-data
2093 .IR SOURCE\-DATA ,
2094 options to specify the OAEP mechanism parameters.
2095 .IP "\(bu" 2
2096 .BR rsa\-aeskw :
2097 Use mechanism
2098 .B CKM_RSA_AES_KEY_WRAP
2099 for key wrapping. Wrapping is done with an RSA public key, unwrapping is done
2100 with the corresponding RSA private key. Use the
2101 .BR \-\-aes\-key\-size
2102 .I AES\-KEYBITS
2103 option to specify the key size of the temporary AES key, and the
2104 .BR \-\-hash\-alg
2105 .IR HASH\-ALG ,
2106 .BR \-\-mgf\-alg
2107 .IR MGF\-ALG ,
2108 and
2109 .B \-\-source\-data
2110 .IR SOURCE\-DATA ,
2111 options to specify the OAEP mechanism parameters.
2112 .IP "\(bu" 2
2113 .BR ecdh\-aeskw ,
2114 .BR ecdh\-cof\-aeskw ,
2115 and
2116 .BR ecdh\-x\-aeskw :
2117 Use mechanisms
2118 .BR CKM_ECDH_AES_KEY_WRAP ,
2119 .BR CKM_ECDH_COF_AES_KEY_WRAP ,
2120 and
2121 .B CKM_ECDH_X_AES_KEY_WRAP
2122 respectively for key wrapping. Wrapping is done with an EC or EC-Montgomery
2123 public key (for
2124 .BR ecdh\-aeskw ),
2125 an EC public key (for
2126 .BR ecdh\-cof\-aeskw ),
2127 or an EC-Montgomery public key (for
2128 .BR ecdh\-x\-aeskw ).
2129 Unwrapping is done with the corresponding EC or EC-Montgomery private key (for
2130 .BR ecdh\-aeskw ),
2131 an EC private key (for
2132 .BR ecdh\-cof\-aeskw ),
2133 or an EC-Montgomery private key (for
2134 .BR ecdh\-x\-aeskw ).
2135 Use the
2136 .BR \-\-aes\-key\-size
2137 .I AES\-KEYBITS
2138 option to specify the key size of the temporary AES key, and the
2139 .BR \-\-kdf\-alg
2140 .IR KDF\-ALG ,
2141 and
2142 .B \-\-shared\-data
2143 .IR SHARED\-DATA ,
2144 options to specify the ECDH mechanism parameters.
2145 .PP
2146 Possible values for the
2147 .I KEYTYPE
2148 argument are:
2149 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
2150 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
2151 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
2152 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
2153 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
2154 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem .
2155 .PP
2156 Specify the
2157 .BR \-\-kek\-label | \-K
2158 .IR LABEL ,
2159 and/or the
2160 .BR \-\-kek\-id | \-k
2161 .IR ID
2162 option to select the key encrypting key (KEK). Only keys with the right object
2163 class and key type that fit to the wrapping mechanism are selected. If
2164 multiple key objects match, you are prompted to confirm to use the desired
2165 key object. If the
2166 .BR \-\-force | \-f
2167 option is specified, then the first matching key object is used.
2168 You can use wildcards (\fB*\fP and \fB?\fP) in the
2169 .I LABEL
2170 specification. To specify a wildcard character that should not be treated as a
2171 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2172 Also, a backslash character that should not be treated as an escape character
2173 must be escaped (\fB\e\e\fP). The
2174 .B ID
2175 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2176 .PP
2177 The
2178 .BR \-\-label | \-L
2179 .I LABEL
2180 option sets the
2181 .B CKA_LABEL
2182 attribute of the unwrapped key and the
2183 .BR \-\-attr | \-a
2184 .I ATTRS
2185 option can be used to set the boolean attributes of the unwrapped key (see
2186 below for detailed description of the attributes). The
2187 .BR \-\-id | \-i
2188 .I ID
2189 option can be used to set the value of the
2190 .B CKA_ID
2191 attribute of the unwrapped key.
2192 .PP
2193 The
2194 .BR \-\-file | \-F
2195 .I FILENAME
2196 option specifies the file name of the file containing the wrapped key material.
2197 By default this is a PEM file using a p11sak-specific type and a header that
2198 contains information about the wrapping mechanism and mechanism parameters
2199 (if any). If option
2200 .BR \-\-raw | \-R
2201 is specified then the file is a raw binary file and the raw wrapped key
2202 material is contained. In this case, arguments
2203 .I WRAP\-MECH
2204 and
2205 .IR KEYTYPE ,
2206 as well as wrapping mechanism specific options to specify mechanism parameters
2207 are required.
2208 .PP
2209 .B Note:
2210 A token may not support all wrapping mechanisms, nor all mechanism parameter
2211 combinations. Also, not all tokens may support to unwrap all key types.
2212 .
2213 .
2214 .
2215 .PP
2216 .SS "Listing certificates"
2217 .
2218 .B p11sak
2219 .BR list\-cert | ls\-cert | lsc
2220 .RI [ CERTTYPE ]
2221 .BR \-\-slot | \-s
2222 .I SLOTID
2223 .RB [ \-\-pin | \-p
2224 .IR PIN ]
2225 .RB [ \-\-force\-pin\-prompt ]
2226 .RB [ \-\-no\-login | \-N ]
2227 .RB [ \-\-so ]
2228 .RB [ \-\-label | \-L
2229 .IR LABEL ]
2230 .RB [ \-\-id | \-i
2231 .IR ID ]
2232 .RB [ \-\-attr | \-a
2233 .IR ATTRS ]
2234 .RB [ \-\-long | \-l ]
2235 .RB [ \-\-detailed\-uri ]
2236 .RB [ \-\-sort | \-S
2237 .IR SORT\-SPEC ]
2238 .RB [ \-\-help | \-h ]
2239 .PP
2240 Use the
2241 .BR list\-cert | ls\-cert | lsc
2242 command and the optional
2243 .I CERTTYPE
2244 argument to list certificates.
2245 .PP
2246 Possible values for the
2247 .I CERTTYPE
2248 argument are:
2249 .BR x509 .
2250 If
2251 .I CERTTYPE
2252 is omitted, then x509 certificates are listed by default, because no other
2253 certificate types are supported.
2254 .PP
2255 Specify the
2256 .BR \-\-label | \-L
2257 .IR LABEL ,
2258 the
2259 .BR \-\-id | \-i
2260 .IR ID ,
2261 and/or the
2262 .BR \-\-attr | \-a
2263 .I ATTRS
2264 options to filter the list of certificates to display. You can use wildcards
2265 (\fB*\fP and \fB?\fP) in the
2266 .I LABEL
2267 specification. To specify a wildcard character that should not be treated as a
2268 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2269 Also, a backslash character that should not be treated as an escape character
2270 must be escaped (\fB\e\e\fP).
2271 The
2272 .B ID
2273 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2274 .PP
2275 By default, the certificates are listed in a short, tabular format showing only the
2276 boolean attributes, the certificate type (\fBCKA_CERTIFICATE_TYPE\fP) and the
2277 certificate label (\fPCKA_LABEL\fP). The attributes are denoted using the same
2278 single letters as used with the
2279 .BR \-\-attr | \-a
2280 .I ATTRS
2281 option. When option
2282 .BR \-\-long | \-l
2283 is specified, the certificates are listed in long format, displaying the values
2284 of all attributes defined for the certificate type, including non-boolean attributes.
2285 .PP
2286 By default, the certificates are displayed in the order as they are retrieved
2287 from the PKCS\~#11 implementation. To display the certificates in a certain
2288 order, specify the
2289 .BR \-\-sort | \-S
2290 .I SORT\-SPEC
2291 option. You can sort the certificates by label and/or subject common name (CN).
2292 For details, see the description of the
2293 .BR \-\-sort | \-S
2294 .I SORT\-SPEC
2295 option below.
2296 .
2297 .PP
2298 .SS "Deleting certificates"
2299 .
2300 .B p11sak
2301 .BR remove\-cert | rm\-cert | rmc
2302 .RI [ CERTTYPE ]
2303 .BR \-\-slot | \-s
2304 .I SLOTID
2305 .RB [ \-\-pin | \-p
2306 .IR PIN ]
2307 .RB [ \-\-force\-pin\-prompt ]
2308 .RB [ \-\-no\-login | \-N ]
2309 .RB [ \-\-so ]
2310 .RB [ \-\-label | \-L
2311 .IR LABEL ]
2312 .RB [ \-\-id | \-i
2313 .IR ID ]
2314 .RB [ \-\-attr | \-a
2315 .IR ATTRS ]
2316 .RB [ \-\-force | \-f ]
2317 .RB [ \-\-help | \-h ]
2318 .PP
2319 Use the
2320 .BR remove\-cert | rm\-cert | rmc
2321 command and the optional
2322 .I CERTTYPE
2323 argument to remove certificates from the repository.
2324 .PP
2325 Possible values for the
2326 .I CERTTYPE
2327 argument are:
2328 .BR x509 .
2329 If
2330 .I CERTTYPE
2331 is omitted, then x509 is used by default, because no other certificate types are
2332 supported.
2333 .PP
2334 Specify the
2335 .BR \-\-label | \-L
2336 .IR LABEL ,
2337 the
2338 .BR \-\-id | \-i
2339 .IR ID ,
2340 and/or the
2341 .BR \-\-attr | \-a
2342 .I ATTRS
2343 options to filter the list of certificates to remove. You can use wildcards
2344 (\fB*\fP and \fB?\fP) in the
2345 .I LABEL
2346 specification. To specify a wildcard character that should not be treated as a
2347 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2348 Also, a backslash character that should not be treated as an escape character
2349 must be escaped (\fB\e\e\fP).
2350 The
2351 .B ID
2352 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2353 .PP
2354 The user is prompted to confirm the removal of the certificate. To suppress
2355 the prompt, use the
2356 .BR \-\-force | \-f
2357 option.
2358 .PP
2359 .
2360 .PP
2361 .SS "Setting or updating attributes of certificates"
2362 .
2363 .B p11sak
2364 .BR set\-cert\-attr | set\-cert | setc
2365 .RI [ CERTTYPE ]
2366 .BR \-\-slot | \-s
2367 .I SLOTID
2368 .RB [ \-\-pin | \-p
2369 .IR PIN ]
2370 .RB [ \-\-force\-pin\-prompt ]
2371 .RB [ \-\-no\-login | \-N ]
2372 .RB [ \-\-so ]
2373 .RB [ \-\-label | \-L
2374 .IR LABEL ]
2375 .RB [ \-\-id | \-i
2376 .IR ID ]
2377 .RB [ \-\-attr | \-a
2378 .IR ATTRS ]
2379 .RB [ \-\-force | \-f ]
2380 .RB [ \-\-new\-attr | \-A
2381 .IR ATTRS ]
2382 .RB [ \-\-new\-label | \-l
2383 .IR LABEL ]
2384 .RB [ \-\-new\-id | \-I
2385 .IR ID ]
2386 .RB [ \-\-help | \-h ]
2387 .PP
2388 Use the
2389 .B set\-cert\-attrs | set\-cert | sect
2390 command and the optional
2391 .I CERTTYPE
2392 argument to set or update boolean attributes of certificates.
2393 .PP
2394 Possible values for the
2395 .I CERTTYPE
2396 argument are:
2397 .BR x509 .
2398 If
2399 .I CERTTYPE
2400 is omitted, x509 is used by default, because no other certificate types are
2401 supported.
2402 .PP
2403 Specify the
2404 .BR \-\-label | \-L
2405 .IR LABEL ,
2406 the
2407 .BR \-\-id | \-i
2408 .IR ID ,
2409 and/or the
2410 .BR \-\-attr | \-a
2411 .I ATTRS
2412 options to filter the list of certificates to set or update. You can use wildcards
2413 (\fB*\fP and \fB?\fP) in the
2414 .I LABEL
2415 specification. To specify a wildcard character that should not be treated as a
2416 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2417 Also, a backslash character that should not be treated as an escape character
2418 must be escaped (\fB\e\e\fP).
2419 The
2420 .B ID
2421 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2422 .PP
2423 Use the
2424 .BR \-\-new\-attr | \-A
2425 .I ATTRS
2426 option to specify the boolean attributes of the certificate you want to update
2427 (see below for detailed description of the attributes). Attributes that are not
2428 specified are not changed. Use the
2429 .BR \-\-new\-label | \-l
2430 .I LABEL
2431 option to specify the new label, or the
2432 .BR \-\-new\-id | \-I
2433 .I ID
2434 option to specify the new ID to set for the certificate. At least one of the
2435 .BR \-\-new\-attr | \-A
2436 .IR ATTRS ,
2437 .BR \-\-new\-label | \-l
2438 .IR LABEL ,
2439 or
2440 .BR \-\-new\-id | \-I
2441 .I ID
2442 options must be specified.
2443 .PP
2444 The user is prompted to confirm the updating of the certificate. To suppress
2445 the prompt, use the
2446 .BR \-\-force | \-f
2447 option.
2448 .PP
2449 .
2450 .SS "Coyping certificates"
2451 .
2452 .B p11sak
2453 .BR copy\-cert | copyc | cpc
2454 .RI [ CERTTYPE ]
2455 .BR \-\-slot | \-s
2456 .I SLOTID
2457 .RB [ \-\-pin | \-p
2458 .IR PIN ]
2459 .RB [ \-\-force\-pin\-prompt ]
2460 .RB [ \-\-no\-login | \-N ]
2461 .RB [ \-\-so ]
2462 .RB [ \-\-label | \-L
2463 .IR LABEL ]
2464 .RB [ \-\-id | \-i
2465 .IR ID ]
2466 .RB [ \-\-attr | \-a
2467 .IR ATTRS ]
2468 .RB [ \-\-force | \-f ]
2469 .RB [ \-\-new\-attr | \-A
2470 .IR ATTRS ]
2471 .RB [ \-\-new\-label | \-l
2472 .IR LABEL ]
2473 .RB [ \-\-new\-id | \-I
2474 .IR ID ]
2475 .RB [ \-\-help | \-h ]
2476 .PP
2477 Use the
2478 .B copy\-cert | copyc | cpc
2479 command and the optional
2480 .I CERTTYPE
2481 argument to copy certificates and optionally set or change boolean attributes,
2482 the label, or ID of the copied certificates.
2483 .PP
2484 Possible values for the
2485 .I CERTTYPE
2486 argument are:
2487 .BR x509 .
2488 If
2489 .I CERTTYPE
2490 is omitted, then x509 is used by default, because no other certificate type is
2491 supported.
2492 .PP
2493 Specify the
2494 .BR \-\-label | \-L
2495 .IR LABEL ,
2496 the
2497 .BR \-\-id | \-i
2498 .IR ID ,
2499 and/or the
2500 .BR \-\-attr | \-a
2501 .I ATTRS
2502 options to filter the list of certificates to copy. You can use wildcards
2503 (\fB*\fP and \fB?\fP) in the
2504 .I LABEL
2505 specification. To specify a wildcard character that should not be treated as a
2506 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2507 Also, a backslash character that should not be treated as an escape character
2508 must be escaped (\fB\e\e\fP).
2509 The
2510 .B ID
2511 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2512 .PP
2513 Use the
2514 .BR \-\-new\-attr | \-A
2515 .I ATTRS
2516 option to specify the boolean attributes of the copied certificates you want to
2517 set or update (see below for detailed description of the attributes). Attributes
2518 that are not specified are not changed. Use the
2519 .BR \-\-new\-label | \-l
2520 .I LABEL
2521 option to specify the new label, or the
2522 .BR \-\-new\-id | \-I
2523 .I ID
2524 option to specify the new ID to set for the copied certificate.
2525 .PP
2526 The user is prompted to confirm the copying of the certificate. To suppress
2527 the prompt, use the
2528 .BR \-\-force | \-f
2529 option.
2530 .PP
2531 .
2532 .SS "Importing x.509 certificates from a file"
2533 .
2534 .B p11sak
2535 .BR import\-cert | importc | impc
2536 .I CERTTYPE
2537 .BR \-\-slot | \-s
2538 .I SLOTID
2539 .RB [ \-\-pin | \-p
2540 .IR PIN ]
2541 .RB [ \-\-force\-pin\-prompt ]
2542 .RB [ \-\-no\-login | \-N ]
2543 .RB [ \-\-so ]
2544 .BR \-\-label | \-L
2545 .I LABEL
2546 .RB [ \-\-id | \-i
2547 .IR ID ]
2548 .RB [ \-\-attr | \-a
2549 .IR ATTRS ]
2550 .BR \-\-file | \-F
2551 .I FILENAME
2552 .RB [ \-\-ca\-cert | \-C ]
2553 .RB [ \-\-help | \-h ]
2554 .PP
2555 Use the
2556 .BR import\-cert | importc | impc
2557 command and
2558 .I CERTTYPE
2559 argument to import an x.509 certificate from a file.
2560 .PP
2561 Possible values for the
2562 .I CERTTYPE
2563 argument are:
2564 .BR x509 .
2565 If
2566 .I CERTTYPE
2567 is omitted, then x509 is used by default, because no other certificate type is
2568 supported.
2569 .PP
2570 The
2571 .BR \-\-label | \-L
2572 .IR LABEL
2573 option sets the
2574 .B CKA_LABEL
2575 attribute of the certificate and the
2576 .BR \-\-attr | \-a
2577 .I ATTRS
2578 can be used to set the boolean attributes of the certificate (see below for
2579 detailed description of the attributes. Applicable attributes for certificates
2580 are P M B Y T). The
2581 .BR \-\-id | \-i
2582 .I ID
2583 option can be used to set the value of the
2584 .B CKA_ID
2585 attribute of the certificate.
2586 .PP
2587 The
2588 .BR \-\-file | \-F
2589 .I FILENAME
2590 option specifies the file name of the file that contains the certificate to be
2591 imported. Supported input formats are PEM and binary (DER-encoded). The format
2592 is automatically detected.
2593 .PP
2594 The
2595 .BR \-\-ca\-cert | \-C
2596 option flags the certificate as a Certificate Authority (CA) certificate.
2597 If the certificate has the \fBBasicConstraints CA\fP flag on, it is also flagged
2598 as Certificate Authority (CA) certificate.
2599 .
2600 .SS "Exporting certificates to a file"
2601 .
2602 .B p11sak
2603 .BR export\-cert | exportc | expc
2604 .RI [ CERTTYPE ]
2605 .BR \-\-slot | \-s
2606 .I SLOTID
2607 .RB [ \-\-pin | \-p
2608 .IR PIN ]
2609 .RB [ \-\-force\-pin\-prompt ]
2610 .RB [ \-\-no\-login | \-N ]
2611 .RB [ \-\-so ]
2612 .RB [ \-\-label | \-L
2613 .IR LABEL ]
2614 .RB [ \-\-id | \-i
2615 .IR ID ]
2616 .RB [ \-\-attr | \-a
2617 .IR ATTRS ]
2618 .RB [ \-\-force | \-f ]
2619 .BR \-\-file | \-F
2620 .I FILENAME
2621 .RB [ \-\-der | \- D ]
2622 .RB [ \-\-uri\-pem | \-u ]
2623 .RB [ \-\-uri\-pin\-value ]
2624 .RB [ \-\-uri\-pin\-source
2625 .IR FILENAME ]
2626 .RB [ \-\-help | \-h ]
2627 .PP
2628 Use the
2629 .BR export\-cert | exportc | expc
2630 command and the optional
2631 .I CERTTYPE
2632 argument to export x.509 public key certificates to a file.
2633 .PP
2634 Possible values for the
2635 .I CERTTYPE
2636 argument are:
2637 .BR x509 .
2638 If
2639 .I CERTTYPE
2640 is omitted, then x509 is used by default, because no other certificate types are
2641 supported.
2642 .PP
2643 Specify the
2644 .BR \-\-label | \-L
2645 .IR LABEL ,
2646 the
2647 .BR \-\-id | \-i
2648 .IR ID ,
2649 and/or the
2650 .BR \-\-attr | \-a
2651 .I ATTRS
2652 options to filter the list of certificates to export. You can use wildcards
2653 (\fB*\fP and \fB?\fP) in the
2654 .I LABEL
2655 specification. To specify a wildcard character that should not be treated as a
2656 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2657 Also, a backslash character that should not be treated as an escape character
2658 must be escaped (\fB\e\e\fP).
2659 The
2660 .B ID
2661 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2662 .PP
2663 The
2664 .BR \-\-file | \-F
2665 .I FILENAME
2666 option specifies the file name of the file to which the certificates to be
2667 exported are written to. This can be an OpenSSL PEM file or binary (DER-encoded)
2668 file. If it's a PEM file, multiple certificates can be exported to the same
2669 file. If it's a binary file, each subsequent export overwrites the previous
2670 data in the output file. You are prompted to confirm to overwrite the previously
2671 created file, unless the
2672 .BR \-\-force | \-f
2673 option is specified.
2674 .PP
2675 Specify the
2676 .BR \-\-der | \-D
2677 option to export the certificate(s) in binary (DER-encoded) form. Default is
2678 PEM format.
2679 .PP
2680 Specify the
2681 .BR \-\-uri\-pem | \-u
2682 option to export the PKCS#11 URI of the certificate in PEM form instead of the
2683 certificate material. Such an URI-PEM file can then be used with the
2684 .B pkcs11\-provider
2685 from
2686 .BR https://github.com/latchset/pkcs11\-provider .
2687 By default, the PKCS#11 URI does not contain the PKCS#11 user pin.
2688 Specify option
2689 .B \-\-uri\-pin\-value
2690 to include the PKCS#11 user pin in the URI using the
2691 .B pin\-value
2692 query attribute. This reveals the PKCS#11 user pin in clear, use with care!
2693 Alternatively, specify option
2694 .B \-\-uri\-pin\-source
2695 .I FILENAME
2696 to include the
2697 .B pin\-source
2698 query attribute in the URI, referencing the file name specified with this
2699 option. The PKCS#11 user pin value is written into that file as part of the
2700 export operation. This reveals the PKCS#11 user pin in clear, use with care!
2701 Adjust the file permissions of the specified pin\-source file so that it can
2702 only be read by the desired user(s). By default the file permissions are set so
2703 that only the owner user can read and write that file, but no one else (i.e.
2704 0600).
2705 .PP
2706 .
2707 .SS "Extracting the public key of certificates"
2708 .
2709 .B p11sak
2710 .BR extract\-cert\-pubkey | extrc\-pubkey | excpub
2711 .RI [ CERTTYPE ]
2712 .BR \-\-slot | \-s
2713 .I SLOTID
2714 .RB [ \-\-pin | \-p
2715 .IR PIN ]
2716 .RB [ \-\-force\-pin\-prompt ]
2717 .RB [ \-\-no\-login | \-N ]
2718 .RB [ \-\-so ]
2719 .RB [ \-\-label | \-L
2720 .IR LABEL ]
2721 .RB [ \-\-id | \-i
2722 .IR ID ]
2723 .RB [ \-\-attr | \-a
2724 .IR ATTRS ]
2725 .RB [ \-\-new\-attr | \-A
2726 .IR ATTRS ]
2727 .RB [ \-\-new\-label | \-l
2728 .IR LABEL ]
2729 .RB [ \-\-new\-id | \-I
2730 .IR ID ]
2731 .RB [ \-\-force | \-f ]
2732 .RB [ \-\-help | \-h ]
2733 .PP
2734 Use the
2735 .BR extract\-cert\-pubkey | extrc\-pubkey | excpub
2736 command and the optional
2737 .I CERTTYPE
2738 argument to extract the public key from certificates and save it
2739 as new token object.
2740 .PP
2741 Possible values for the
2742 .I CERTTYPE
2743 argument are:
2744 .BR x509 .
2745 If
2746 .I CERTTYPE
2747 is omitted, then x509 is used by default, because no other certificate types are
2748 supported.
2749 .PP
2750 Specify the
2751 .BR \-\-label | \-L
2752 .IR LABEL ,
2753 the
2754 .BR \-\-id | \-i
2755 .IR ID ,
2756 and/or the
2757 .BR \-\-attr | \-a
2758 .I ATTRS
2759 options to filter the certificates of which the public keys are to be extracted.
2760 You can use wildcards (\fB*\fP and \fB?\fP) in the
2761 .I LABEL
2762 specification. To specify a wildcard character that should not be treated as a
2763 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
2764 Also, a backslash character that should not be treated as an escape character
2765 must be escaped (\fB\e\e\fP).
2766 The
2767 .B ID
2768 must be specified as hex string (not prefixed with 0x) of any number of bytes.
2769 .PP
2770 Use the
2771 .BR \-\-new\-attr | \-A
2772 .I ATTRS
2773 option to specify the boolean attributes of the public key object you want to
2774 set (see below for detailed description of the attributes).
2775 Use the
2776 .BR \-\-new\-label | \-l
2777 .I LABEL
2778 option to specify the new label. If no new label is specified, the label of the
2779 public key object is derived from the certificate label by appending
2780 .BR _pubkey .
2781 .PP
2782 Use the
2783 .BR \-\-new\-id | \-I
2784 .I ID
2785 option to set an ID for the extracted public key object.
2786 .PP
2787 The user is prompted to confirm the extraction of the public key from the
2788 certificate. To suppress the prompt, use the
2789 .BR \-\-force | \-f
2790 option.
2791 .PP
2792 .
2793 .
2794 .SH ARGUMENTS
2795 .
2796 .SS "KEYTYPE"
2797 .
2798 Selects the respective symmetric or asymmetric key to be generated, imported or
2799 selected. Possible values are:
2800 .BR des |\: 3des |\: generic |\: sha\-1\-hmac |\: sha224\-hmac |\: \
2801 sha256\-hmac |\: sha384\-hmac |\: sha512\-hmac |\: sha512/224\-hmac |\: \
2802 sha512/256\-hmac |\: sha3\-224\-hmac |\: sha3\-256\-hmac |\: sha3\-384\-hmac \
2803 |\: sha3\-512\-hmac |\: aes |\: aes\-xts |\: rsa |\: dh |\: dsa |\: ec |\: \
2804 ec\-edwards |\: ec\-montgomery |\: ibm\-dilithium |\: ibm\-kyber |\: \
2805 ibm\-ml\-dsa |\: ibm\-ml\-kem |\: ml\-dsa |\: ml\-kem |\: public |\: private \
2806 |\: secret |\: all .
2807 The
2808 .BR public |\: private |\: secret |\: all
2809 argument can only be used with commands that use the
2810 .I KEYTYPE
2811 argument as filter, such as the
2812 .B list\-key
2813 command, the
2814 .B remove\-key
2815 command, the
2816 .B set\-key\-attrs
2817 command, or the
2818 .B export\-key
2819 command.
2820 .PP
2821 .
2822 .SS "CERTTYPE"
2823 .
2824 Selects the type of certificate to be imported, exported, listed, copied,
2825 updated, removed, or selected for public key extraction.
2826 Possible values are:
2827 .BR x509 .
2828 If no certificate type is specified, certificate type x509 is used, because
2829 currently no other certificate types are supported.
2830 .
2831 .PP
2832 .
2833 .SS "KEYBITS"
2834 .
2835 Specifies the size of the key in bits. For the
2836 .B aes
2837 key type, possible values are
2838 .BR 128 | 192 | 256 .
2839 For the
2840 .B aes\-xts
2841 key type, possible values are
2842 .BR 128 | 256 .
2843 For the
2844 .B rsa
2845 key type, the key size must be from 512 to 16384 and a multiple of 8 bits.
2846 Typical key sizes are 512, 1024, 2048, 4096, or 8192. Not all RSA key sizes
2847 might be supported by all tokens.
2848 .PP
2849 .
2850 .SS "PUBL\-EXP"
2851 .
2852 Specifies the public exponent for an RSA key. If not specified, the default is
2853 65537 according to the PKCS\~#11 standard.
2854 .PP
2855 .
2856 .SS "PRIV\-BITS"
2857 .
2858 Specifies the size of the private key in bits for an DH key.
2859 .PP
2860 .
2861 .SS "GROUP"
2862 .
2863 Specifies the Diffie\-Hellman FFC group name for an DH key. Possible values are
2864 .BR ffdhe2048 |\: ffdhe3072 |\: ffdhe4096 |\: ffdhe6144 |\: ffdhe8192 |\: \
2865 modp1536 |\: modp2048 |\: modp3072 |\: modp4096 |\: modp6144 |\: modp8192 .
2866 .PP
2867 .B Note:
2868 Not all groups are supported by all tokens and key generation fails
2869 when the specified
2870 .I GROUP
2871 is not supported. Also, not all groups are supported by all OpenSSL versions.
2872 If the
2873 .B p11sak
2874 tool is compiled against an OpenSSL version that does not support certain
2875 groups, then those groups are not accepted for the
2876 .I GROUP
2877 argument.
2878 .PP
2879 .
2880 .SS "DH\-PARAM\-PEM\-FILE"
2881 .
2882 Specifies the DH parameters PEM file name. You can for example generate DH
2883 parameters using the OpenSSL command line tool as follows: \fB'openssl dhparam
2884 <numbits> \-out <pem\-file> \-outform PEM' \fP. See the OpenSSL man page for
2885 details about this command.
2886 .PP
2887 .
2888 .SS "DSA\-PARAM\-PEM\-FILE"
2889 .
2890 Specifies the DSA parameters PEM file name. You can for example generate DSA
2891 parameters using the OpenSSL command line tool as follows: \fB'openssl dsaparam
2892 <numbits> \-out <pem\-file> \-outform PEM' \fP. See the OpenSSL man page for
2893 details about this command.
2894 .PP
2895 .
2896 .SS "CURVE"
2897 .
2898 Specifies the curve for an EC, EC-Edwards, or EC-Montgomery key.
2899 For the EC key type possible values are:
2900 .BR prime256v1 |\: prime192 |\: secp224 |\: secp384r1 |\: secp521r1 |\: \
2901 secp265k1 |\: brainpoolP160r1 |\: brainpoolP160t1 |\: brainpoolP192r1 |\: \
2902 brainpoolP192t1 |\: brainpoolP224r1 |\: brainpoolP224t1 |\: brainpoolP256r1 \
2903 |\: brainpoolP256t1 |\: brainpoolP320r1 |\: brainpoolP320t1 |\: \
2904 brainpoolP384r1 |\: brainpoolP384t1 |\: brainpoolP512r1 |\: brainpoolP512t1 \
2905 |\: curve25519 |\: curve448 |\: ed25519 |\: ed448 |\: bls12-381 .
2906 Note that using an Edwards or Montgomery curve for the EC key type only works
2907 for the EP11 token and produces a non-PKCS#11-standard EC key.
2908 For the EC-Edwards key type possible values are:
2909 .BR ed25519 |\: ed448 .
2910 For the EC-Montgomery key type possible values are:
2911 .BR curve25519 |\: curve448 .
2912 .PP
2913 .
2914 .SS "VERSION"
2915 .
2916 Specifies the version for an IBM Dilithium, IBM Kyber, IBM ML\-DSA, IBM ML\-KEM,
2917 ML\-DSA, or ML\-KEM key.
2918 For the
2919 .B ibm\-dilithium
2920 key type, possible values are
2921 .BR r2_65 |\: r2_87 |\: r3_44 |\: r3_65 |\: r3_87 .
2922 For the
2923 .B ibm\-kyber
2924 key type, possible values are
2925 .BR r2_768 |\: r2_1024 .
2926 For the
2927 .B ibm\-ml\-dsa
2928 and
2929 .B ml\-dsa
2930 key types, possible values are
2931 .BR 44 |\: 65 |\: 87 .
2932 For the
2933 .B ibm\-ml\-kem
2934 and
2935 .B ml\-kem
2936 key types, possible values are
2937 .BR 512 |\: 768 |\: 1024 .
2938 .PP
2939 .
2940 .SS "KIND"
2941 .
2942 Specifies the kind of the asymmetric key to import. Possible values are
2943 .BR public | private .
2944 .PP
2945 .
2946 .SS "WRAP\-MECH"
2947 .
2948 Specifies the wrapping mechanism for use with exporting or importing a key by
2949 wrapping it with a key encrypting key. Possible values are
2950 .BR aes\-cbc\-pad |\: aeskw\-kwp |\: aeskw\-pkcs7 |\: rsa\-pkcs |\: rsa\-oaep \
2951 |\: rsa\-aeskw |\: ecdh\-aeskw |\: ecdh\-cof\-aeskw |\: ecdh\-x\-aeskw .
2952 Dependent on the key wrapping mechanism, additional options may be supported
2953 to specify mechanism parameters. See sections
2954 .B Exporting a key by wrapping it with a key encrypting key
2955 and
2956 .B Importing a key by unwrapping it with a key encrypting key
2957 under
2958 .B COMMANDS
2959 for a description of the wrapping mechanism and its mechanism parameter options.
2960 .PP
2961 .
2962 .
2963 .
2964 .SH OPTIONS
2965
2966 .TP 8
2967 .BR \-\-slot | \-s\~\fISLOT\fP
2968 Specifies the slot number of the token to use.
2969 .PP
2970 .
2971 .
2972 .
2973 .TP 8
2974 .BR \-\-pin | \-p\~\fIPIN\fP
2975 Specifies the token user PIN to login with.
2976 .PP
2977 .RS 8
2978 Alternatively, the
2979 .B PKCS11_USER_PIN
2980 environment variable may be used to provide the token user PIN.
2981 If neither this option is specified nor the environment variable is set,
2982 you are prompted for the PIN.
2983 .RE
2984 .PP
2985 .
2986 .
2987 .
2988 .TP 8
2989 .BR \-\-force\-pin\-prompt
2990 Enforce the
2991 .B p11sak
2992 tool to prompt for the token user PIN (regardless if it has been specified
2993 elsewhere)
2994 .PP
2995 .
2996 .
2997 .
2998 .TP 8
2999 .BR \-\-no\-login | \-N
3000 Do not login the session. This means that only public token objects
3001 .RB ( CKA_PRIVATE = FALSE )
3002 can be accessed.
3003 .PP
3004 .
3005 .
3006 .
3007 .TP 8
3008 .BR \-\-so
3009 Login as
3010 .BR SO \~( security\~officer ).
3011 Option
3012 .BR \-\-pin | \-p
3013 .I PIN
3014 must specify the SO pin, or if the
3015 .BR \-\-pin | \-p
3016 .I PIN
3017 option is not specified, environment variable
3018 .B PKCS11_SO_PIN
3019 is used. If
3020 .B PKCS11_SO_PIN
3021 is not set, you are prompted for the SO PIN. SO can only access public
3022 token objects
3023 .RB ( CKA_PRIVATE = FALSE ),
3024 but SO can set attribute
3025 .B CKA_TRUSTED
3026 to
3027 .B TRUE
3028 for secret key objects, public key objects, and certificate objects.
3029 .PP
3030 .
3031 .
3032 .
3033 .TP 8
3034 .BR \-\-label | \-L\~\fILABEL\fP | \fIPUB\-LABEL\fP : \fIPRIV\-LABEL\fP
3035 Specifies the key label attribute value (\fBCKA_LABEL\fP).
3036 .PP
3037 .RS 8
3038 For commands such as the
3039 .B list\-key
3040 command, the
3041 .B remove\-key
3042 command, the
3043 .B set\-key\-attrs
3044 command, the
3045 .B export\-key
3046 command, and the
3047 .B wrap\-key
3048 command, specify the label to filter the list of keys to operate on. You can
3049 use wildcards (\fB*\fP and \fB?\fP) in the
3050 .I LABEL
3051 specification. To specify a wildcard character that should not be treated as a
3052 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
3053 Also, a backslash character that should not be treated as an escape character
3054 must be escaped (\fB\e\e\fP).
3055 .PP
3056 For generation of asymmetric keys, the specified label is appended by \fB:pub\fP
3057 and \fB:prv\fP for the public and private key objects. Optionally, a user can
3058 set different labels for the public and private key objects by specifying them
3059 separated by a colon (\fB:\fP), e.g. \fBpub\-label:priv\-label\fP. The label
3060 string in front of the colon is used as label for the public key object, the
3061 label string after the colon is used for the private key object.
3062 To set the public and private key label the exact same, use \fBpub\-label:=\fP.
3063 The equal sign (\fB=\fP) means to use the same label string for the private
3064 key objects as for the public key object.
3065 In case a colon character or a equal sign is supposed to appear within
3066 a label string, it must be escaped using a back slash (\fB\\\fP), e.g.
3067 \fBabc\\:xyz\fP results in \fBabx:xyz\fP where the colon is not treated as
3068 separator character.
3069 Note that the shell may interpret escape characters as well, so better quote
3070 the \fILABEL\fP|\fIPUB\-LABEL\fP:\fIPRIV\-LABEL\fP specification.
3071 .RE
3072 .PP
3073 .
3074 .
3075 .
3076 .TP 8
3077 .BR \-\-id | \-i\~\fIID\fP
3078 Specifies the key ID attribute value (\fBCKA_ID\fP) as hex string (not prefixed
3079 with 0x) of any number of bytes.
3080 .PP
3081 .RS 8
3082 For commands such as the
3083 .B list\-key
3084 command, the
3085 .B remove\-key
3086 command, the
3087 .B set\-key\-attrs
3088 command, the
3089 .B export\-key
3090 command, and the
3091 .B wrap\-key
3092 command, specify the key ID to filter the list of keys to operate on.
3093 .PP
3094 For generation of asymmetric keys, the same ID is set for both, the public and
3095 the private key.
3096 .RE
3097 .PP
3098 .
3099 .
3100 .
3101 .TP 8
3102 .BR \-\-attr | \-a\~\fIATTRS\fP | \fIPUB\-ATTRS\fP : \fIPRIV\-ATTRS\fP
3103 For the
3104 .B generate\-key
3105 command, the
3106 .B import\-key
3107 command, and the
3108 .B unwrap\-key
3109 command, specify the boolean attributes that are to be set for the new key(s).
3110 For commands such as the
3111 .B list\-key
3112 command, the
3113 .B remove\-key
3114 command, the
3115 .B set\-key\-attrs
3116 command, the
3117 .B export\-key
3118 command, and the
3119 .B wrap\-key
3120 command, specify the attribute values to filter the list of keys to operate on.
3121 .PP
3122 .RS 8
3123 .B Note:
3124 Not all boolean attributes are applicable to all key types and/or commands and
3125 are silently ignored if not applicable.
3126 .PP
3127 The respective attributes are set to
3128 .B TRUE
3129 when the corresponding letter is specified in uppercase, or
3130 .B FALSE
3131 when the corresponding letter is specified in lowercase.
3132 Attributes (except \fBCKA_TOKEN\fP and \fBCKA_SENSITIVE\fP, see below) that are
3133 not specified get the default value as defined by the PKCS\~#11 standard or the
3134 used PKCS\~#11 token implementation when generating keys, or are not updated
3135 when setting the attributes of an existing key.
3136 .PP
3137 Attribute
3138 .B CKA_TOKEN
3139 is always set to \fBTRUE\fP when generating a key. The
3140 .B p11sak
3141 tool always generates token keys, since session keys are not persistent, and
3142 thus would no longer exist after the session that the
3143 .B p11sak
3144 tool has opened for generating the key is closed when it exists.
3145 .PP
3146 When generating or importing a key with the
3147 .B p11sak
3148 tool, attribute
3149 .B CKA_SENSITIVE
3150 defaults to \fBTRUE\fP for secret keys or the private key of asymmetric
3151 key pairs. However, this can be overridden by specifying the respective
3152 uppercase or lowercase letter for the CKA_SENSITIVE attribute in the attribute
3153 string, as desired.
3154 .PP
3155 .B Note:
3156 The default setting for the
3157 .B CKA_SENSITIVE
3158 attribute is defined by the
3159 .B p11sak
3160 tool, and might be different from the default setting that would be chosen by
3161 the used PKCS\~#11 implementation.
3162 .PP
3163 The following letters are associated with the respective
3164 .BR CK_ATTRIBUTE :
3165 .IP "\(bu" 2
3166 .B P
3167 \- CKA_PRIVATE
3168 .IP "\(bu" 2
3169 .B L
3170 \- CKA_LOCAL (read only)
3171 .IP "\(bu" 2
3172 .B M
3173 \- CKA_MODIFIABLE
3174 .IP "\(bu" 2
3175 .B B
3176 \- CKA_COPYABLE
3177 .IP "\(bu" 2
3178 .B Y
3179 \- CKA_DESTROYABLE
3180 .IP "\(bu" 2
3181 .B R
3182 \- CKA_DERIVE
3183 .IP "\(bu" 2
3184 .B E
3185 \- CKA_ENCRYPT
3186 .IP "\(bu" 2
3187 .B D
3188 \- CKA_DECRYPT
3189 .IP "\(bu" 2
3190 .B G
3191 \- CKA_SIGN
3192 .IP "\(bu" 2
3193 .B C
3194 \- CKA_SIGN_RECOVER
3195 .IP "\(bu" 2
3196 .B V
3197 \- CKA_VERIFY
3198 .IP "\(bu" 2
3199 .B O
3200 \- CKA_VERIFY_RECOVER
3201 .IP "\(bu" 2
3202 .B W
3203 \- CKA_WRAP
3204 .IP "\(bu" 2
3205 .B U
3206 \- CKA_UNWRAP
3207 .IP "\(bu" 2
3208 .B S
3209 \- CKA_SENSITIVE
3210 .IP "\(bu" 2
3211 .B A
3212 \- CKA_ALWAYS_SENSITIVE (read only)
3213 .IP "\(bu" 2
3214 .B X
3215 \- CKA_EXTRACTABLE
3216 .IP "\(bu" 2
3217 .B N
3218 \- CKA_NEVER_EXTRACTABLE (read only)
3219 .IP "\(bu" 2
3220 .B T
3221 \- CKA_TRUSTED (can only be set to TRUE by SO user)
3222 .IP "\(bu" 2
3223 .B I
3224 \- CKA_WRAP_WITH_TRUSTED
3225 .IP "\(bu" 2
3226 .B H
3227 \- CKA_ALWAYS_AUTHENTICATE (for keys of class CKO_PRIVATE_KEY only, can only be
3228 set to TRUE if CKA_PRIVATE is also TRUE)
3229 .IP "\(bu" 2
3230 .B J
3231 \- CKA_ENCAPSULATE
3232 .IP "\(bu" 2
3233 .B Q
3234 \- CKA_DECAPSULATE
3235 .IP "\(bu" 2
3236 .B K
3237 \- CKA_IBM_PROTKEY_EXTRACTABLE (IBM specific, not all tokens support this)
3238 .IP "\(bu" 2
3239 .B Z
3240 \- CKA_IBM_PROTKEY_NEVER_EXTRACTABLE (IBM specific, not all tokens support this,
3241 read only)
3242 .PP
3243 For multiple attributes, specify a set of these letters without any blanks in
3244 between, e. g. \fB'MlD'\fP. An uppercase letter means \fBTRUE\fP, while a
3245 lowercase letter means \fBFALSE\fP.
3246 From Example above, \fB'MlD'\fP corresponds to: \fBCKA_MODIFIABLE=TRUE,
3247 CKA_LOCAL=FALSE, CKA_DECRYPT=TRUE\fP.
3248 .PP
3249 For generating asymmetric keys set individual key attributes for public and
3250 private key separated by a colon (\fB:\fP). The attributes in front of the colon
3251 are set for the public key and the attributes after the colon are set for the
3252 private key. When no colon is used, the same attribute set is used for
3253 both, the public and private keys. To set a configuration for only the public
3254 key, the string must end with the colon and respectively, to use a
3255 configuration for the private key only, the string must start with the
3256 colon.
3257 .PP
3258 .RE
3259 .
3260 .
3261 .
3262 .TP 8
3263 .BR \-\-new\-attr | \-A\~\fIATTRS\fP
3264 Specifies the boolean attributes to set or update for a key with the
3265 .B set\-key\-attr
3266 or
3267 .B copy\-key
3268 commands. See the description of the
3269 .BR \-\-attr | \-a
3270 option above for a list of letters that are associated with the respective
3271 .BR CK_ATTRIBUTE .
3272 .
3273 .
3274 .
3275 .TP 8
3276 .BR \-\-new\-label | \-L\~\fILABEL\fP
3277 Specifies the new label attribute value (\fBCKA_LABEL\fP) to set for the key.
3278 .RE
3279 .PP
3280 .
3281 .
3282 .
3283 .TP 8
3284 .BR \-\-new\-id | \-I\~\fIID\fP
3285 Specifies the new ID attribute value (\fBCKA_ID\fP) as hex string (not prefixed
3286 with 0x) of any number of bytes to set for the key.
3287 .RE
3288 .PP
3289 .
3290 .
3291 .
3292 .TP 8
3293 .BR \-\-long | \-l
3294 Prints the
3295 .B list\-key
3296 output in long format, displaying the values of all attributes defined for the
3297 key type, including non-boolean attributes. If the
3298 .BR \-\-long | \-l
3299 option is omitted, the output is in a
3300 short, tabular format, showing only the boolean attributes, the key type
3301 (\fBCKA_KEY_TYPE\fP) and the key label (\fBCKA_LABEL\fP).
3302 .RE
3303 .PP
3304 .
3305 .
3306 .
3307 .TP 8
3308 .B \-\-detailed\-uri
3309 Displayes a detailed PKCS\~#11 URI.
3310 .RE
3311 .PP
3312 .
3313 .
3314 .
3315 .TP 8
3316 .BR \-\-hsm\-mkvp | \-m
3317 Shows the HSM master key verification patterns (MKVPs) of the key objects.
3318 This option is only valid for secure key tokens, such as the CCA and EP11
3319 tokens.
3320 .RE
3321 .PP
3322 .
3323 .
3324 .
3325 .TP 8
3326 .BR \-\-ep11\-session\-id | \-e
3327 Shows the EP11 session-IDs of the key objects. This option is only valid for
3328 EP11 tokens.
3329 .RE
3330 .PP
3331 .
3332 .
3333 .
3334 .TP 8
3335 .BR \-\-sort | \-S\~\fISORT\-SPEC\fP
3336 Sort the keys by label, key type, object class, and/or key size. Sort
3337 certificates by label and/or subject common name (CN). Specify a sort
3338 selection of up to 4 fields, each field represented by its corresponding letter,
3339 separated by comma
3340 .RB ( , ):
3341 .RS 8
3342 .IP "\(bu" 2
3343 .B l
3344 - sort by label (keys and certificates)
3345 .RB ( CKA_LABEL )
3346 .IP "\(bu" 2
3347 .B k
3348 - sort by key type (keys only)
3349 .RB ( CKA_KEY_TYPE )
3350 .IP "\(bu" 2
3351 .B c
3352 - sort by object class (keys only)
3353 .RB ( CKA_CLASS ,
3354 secret key, private key, public key)
3355 .IP "\(bu" 2
3356 .B s
3357 - sort by key size (keys only)
3358 .RB ( CKA_VALUE_LEN ,
3359 or derived from other key type specific attribute)
3360 .IP "\(bu" 2
3361 .B n
3362 - sort by common name (certificates only)
3363 .PP
3364 The sort order can be appended to the field designator by a colon
3365 .RB ( : )
3366 and its corresponding letter:
3367 .IP "\(bu" 2
3368 .B a
3369 - ascending order (default)
3370 .IP "\(bu" 2
3371 .B d
3372 - descending order
3373 .PP
3374 Example:
3375 .B l:a,k:d
3376 sorts by label in ascending order and then by key type in descending order.
3377 .RE
3378 .PP
3379 .
3380 .
3381 .
3382 .TP 8
3383 .BR \-\-force | \-f
3384 Suppress the prompt whether the user wants to remove, update, or export the keys
3385 matching the specified \fIKEYTYPE\fP, label, and ID filter (if specified).
3386 For the
3387 .B wrap\-key
3388 command and the
3389 command, and the
3390 .B unwrap\-key
3391 command, also supress the prompt for a confirmation to use a key as KEK.
3392 .RE
3393 .PP
3394 .
3395 .
3396 .
3397 .TP 8
3398 .BR \-\-file | \-F\~\fIFILENAME\fP
3399 For the
3400 .B import\-key
3401 command, this option specifies the file name of the file that contains the key
3402 to be imported. For symmetric keys, this is a binary file containing the key
3403 material in clear. For asymmetric keys, this is an OpenSSL PEM file containing
3404 a public or private key. PEM files used for importing keys can be password
3405 protected. Specify the PEM password with the
3406 .BR \-\-pem\-password | \-P
3407 .I PASSWORD
3408 option or environment variable
3409 .BR P11SAK_PEM_PASSWORD .
3410 If the PEM file is password protected, but no PEM password is specified, you
3411 are prompted for the PEM password.
3412 .PP
3413 .RS 8
3414 For the
3415 .B export\-key
3416 command, this option specifies the file name of the file to which the keys to
3417 be exported are written to. For symmetric keys, this is a binary file where the
3418 key material in clear is written to. For asymmetric keys, this is an OpenSSL
3419 PEM file where the public or private keys are written to. If multiple asymmetric
3420 keys match the filter, the keys are appended to the PEM file specified with this
3421 option. If multiple symmetric keys or a mixture of asymmetric and symmetric keys
3422 match the filter, you are prompted to confirm to overwrite the previously
3423 created file, unless the
3424 .BR \-\-force | \-f
3425 option is specified.
3426 .PP
3427 For the
3428 .B wrap\-key
3429 command, this option specifies the file name of the file to which the wrapped
3430 key material is written to. By default this is a PEM file using a p11sak
3431 specific type and a header that contains information about the wrapping
3432 mechanism and mechanism parameters (if any). If option
3433 .BR \-\-raw | \-R
3434 is specified then the file is a raw binary file and the raw wrapped key
3435 material is written to it. If multiple keys match the filter, the keys are
3436 appended to the PEM file specified with the
3437 .BR \-\-file | \-F
3438 .I FILENAME
3439 option. If option
3440 .BR \-\-raw | \-R
3441 is specified, and multiple keys match the filter, you are prompted to
3442 confirm to overwrite the previously created file, unless the
3443 .BR \-\-force | \-f
3444 option is specified.
3445 .PP
3446 For the
3447 .B unwrap\-key
3448 command, this option specifies the file name of the file containing the wrapped
3449 key material. By default this is a PEM file using a p11sak-specific type and a
3450 header that contains information about the wrapping mechanism and mechanism
3451 parameters (if any). If option
3452 .BR \-\-raw | \-R
3453 is specified then the file is a raw binary file and the raw wrapped key
3454 material is contained.
3455 .RE
3456 .PP
3457 .
3458 .
3459 .
3460 .TP 8
3461 .BR \-\-encrypted\-pem
3462 Encrypt the PEM file using
3463 .B AES\-CBC
3464 with an
3465 .B AES 256
3466 bit key derived from a password via
3467 .BR PBKDF2 .
3468 The PEM password can be specified with the
3469 .BR \-\-pem\-password | \-P
3470 .I PASSWORD
3471 option, or environment variable
3472 .BR P11SAK_PEM_PASSWORD ,
3473 otherwise you are prompted for the PEM password.
3474 This option is only valid for exporting private keys. It is not allowed when
3475 exporting SPKIs, opaque secure key blobs, or URI-PEMs, and it is ignored when
3476 exporting public or secret keys.
3477 .RE
3478 .PP
3479 .
3480 .
3481 .
3482 .TP 8
3483 .BR \-\-pem\-password | \-P\~\fIPASSWORD\fP
3484 Specifies the password of the PEM file specified with the
3485 .BR \-\-file | \-F
3486 .I FILENAME
3487 option for the
3488 .B import\-key
3489 and
3490 .B export\-key
3491 commands. If the PEM file is password protected, but this option is not
3492 specified, nor environment variable
3493 .B P11SAK_PEM_PASSWORD
3494 is set, you are prompted for the PEM password.
3495 .RE
3496 .PP
3497 .
3498 .
3499 .
3500 .TP 8
3501 .BR \-\-force\-pem\-pwd\-prompt
3502 Enforce the
3503 import\-key
3504 command to prompt for the PEM password (regardless if it has been specified
3505 elsewhere).
3506 .RE
3507 .PP
3508 .
3509 .
3510 .
3511 .TP 8
3512 .BR \-\-opaque
3513 The key material in the file specified with the
3514 .BR \-\-file | \-F
3515 .I FILENAME
3516 option is an opaque secure key blob. Not all tokens support this.
3517 .RE
3518 .PP
3519 .
3520 .
3521 .
3522 .TP 8
3523 .BR \-\-oqsprovider\-pem
3524 The key material in the PEM file specified with the
3525 .BR \-\-file | \-F
3526 .I FILENAME
3527 option is in the
3528 .B oqsprovider
3529 format. This option is only valid for the
3530 .B ibm\-dilithium
3531 keytype. PEM files in
3532 .B oqsprovider
3533 format are only supported when the
3534 .B oqsprovider
3535 from
3536 .B https://github.com/open\-quantum\-safe/oqs\-provider
3537 has been configured with OpenSSL 3.0 or later.
3538 .PP
3539 .RS 8
3540 .B Note:
3541 This is an experimental feature, it may change in an incompatible way in the
3542 future!
3543 .RE
3544 .PP
3545 .
3546 .
3547 .
3548 .TP 8
3549 .BR \-\-der | \-D
3550 The certificate is written to the file in binary (DER-encoded) form. Default is
3551 PEM format. Note that only one certificate can be written into a given file in
3552 DER-encoded form, while multiple certificates can be written into the same file
3553 in PEM format.
3554 .RE
3555 .PP
3556 .
3557 .
3558 .
3559 .TP 8
3560 .BR \-\-uri\-pem | \-u
3561 Export the key's or certificate's PKCS#11 URI in PEM form instead of the key or
3562 certificate material. Such an URI-PEM file can then be used with the
3563 .B pkcs11\-provider
3564 from
3565 .BR https://github.com/latchset/pkcs11\-provider .
3566 .RE
3567 .PP
3568 .
3569 .
3570 .
3571 .TP 8
3572 .BR \-\-uri\-pin\-value
3573 When exporting the key's or certificate's PKCS#11 URI in PEM form, include the
3574 PKCS#11 user pin value in the URI using the
3575 .B pin\-value
3576 query attribute. This reveals the PKCS#11 user pin in clear, use with care!
3577 This option can only be used together with the
3578 .BR \-\-uri\-pem | \-u
3579 option, and when options
3580 .BR \-\-no\-login | \-N
3581 and
3582 .BR \-\-so
3583 are not specified.
3584 .RE
3585 .PP
3586 .
3587 .
3588 .
3589 .TP 8
3590 .BR \-\-uri\-pin\-source\~\fIFILENAME\fP
3591 When exporting the key's or certificate's PKCS#11 URI in PEM form, include the
3592 .B pin\-source
3593 query attribute in the URI, referencing the file name specified with this
3594 option. The PKCS#11 user pin value is written into that file as part of the
3595 export operation. This reveals the PKCS#11 user pin in clear, use with care!
3596 Adjust the file permissions of the specified file so that it can only be read
3597 by the desired user(s). This option can only be used together with the
3598 .BR \-\-uri\-pem | \-u
3599 option, and when options
3600 .BR \-\-no\-login | \-N
3601 and
3602 .BR \-\-so
3603 are not specified.
3604 .RE
3605 .PP
3606 .
3607 .
3608 .
3609 .TP 8
3610 .BR \-\-kek\-label | \-K\~\fILABEL\fP
3611 Select the key encrypting key (KEK) by label. Only keys with the right object
3612 class and key type that fit to the wrapping mechanism are selected.
3613 If multiple key objects match, you are prompted to confirm to use the
3614 desired key object. If the
3615 .BR \-\-force | \-f
3616 option is specified, then the first matching key object is used.
3617 You can use wildcards (\fB*\fP and \fB?\fP) in the
3618 .I LABEL
3619 specification. To specify a wildcard character that should not be treated as a
3620 wildcard, it must be escaped using a backslash (\fB\e*\fP or \fB\e?\fP).
3621 Also, a backslash character that should not be treated as an escape character
3622 must be escaped (\fB\e\e\fP).
3623 .RE
3624 .PP
3625 .
3626 .
3627 .
3628 .TP 8
3629 .BR \-\-kek\-id | \-k\~\fILABEL\fP
3630 Select the key encrypting key (KEK) by ID. Only keys with the right object
3631 class and key type that fit to the wrapping mechanism are selected.
3632 Specify a hex string (not prefixed with 0x) of any number of bytes.
3633 If multiple key objects match, you are prompted to confirm to use the
3634 desired key object. If the
3635 .BR \-\-force | \-f
3636 option is specified, then the first matching key object is used.
3637 .RE
3638 .PP
3639 .
3640 .
3641 .
3642 .TP 8
3643 .BR \-\-ca\-cert | \-C
3644 Flag the certificate as a Certificate Authority (CA) certificate.
3645 If the certificate has the \fBBasicConstraints CA\fP flag on, it is also flagged
3646 as Certificate Authority (CA) certificate.
3647 .RE
3648 .PP
3649 .
3650 .
3651 .
3652 .TP 8
3653 .BR \-\-help | \-h
3654 Prints help for the usage of the
3655 .B p11sak
3656 tool and/or the respective command and then exits.
3657 .RE
3658 .PP
3659 .
3660 .
3661 .
3662 .TP 8
3663 .BR \-\-version | \-v
3664 Prints the version of the
3665 .B p11sak
3666 tool and then exits.
3667 .RE
3668 .PP
3669 .
3670 .
3671 .
3672 .SS OPTIONS FOR ARGUMENT \fIWRAP\-MECH\fB VALUE aes\-cbc\-pad:
3673 .
3674 .TP 8
3675 .BR \-\-iv | \-I~\fIIV\fP
3676 The initialization vector (IV) for the AES\-CBC operation. Specify a hex
3677 string (not prefixed with 0x) of exactly 16 bytes. The default is to use 16
3678 all zero bytes.
3679 .RE
3680 .PP
3681 .
3682 .
3683 .
3684 .SS OPTIONS FOR ARGUMENT \fIWRAP\-MECH\fB VALUE aeskw\-kwp:
3685 .
3686 .TP 8
3687 .BR \-\-iv | \-I~\fIIV\fP
3688 The initialization vector (IV) for the AESKW\-KWP operation. Specify a hex
3689 string (not prefixed with 0x) of exactly 4 bytes. If no IV is specified then
3690 the default IV as per AESKW\-KWP specification is used.
3691 .RE
3692 .PP
3693 .
3694 .
3695 .
3696 .SS OPTIONS FOR ARGUMENT \fIWRAP\-MECH\fB VALUE aeskw\-pkcs7:
3697 .
3698 .TP 8
3699 .BR \-\-iv | \-I~\fIIV\fP
3700 The initialization vector (IV) for the AESKW\-PKCS7 operation. Specify a hex
3701 string (not prefixed with 0x) of exactly 8 bytes. If no IV is specified then
3702 the default IV as per AESKW\-PKCS7 specification is used.
3703 .RE
3704 .PP
3705 .
3706 .
3707 .
3708 .SS OPTIONS FOR ARGUMENT \fIWRAP\-MECH\fB VALUE rsa\-oaep:
3709 .
3710 .TP 8
3711 .BR \-\-hash\-alg\~\fIHASH\-ALG\fP
3712 The message digest algorithm used to calculate the digest of the OAEP encoding
3713 parameter. The default is to use the samealgorithm as specified with option
3714 .BR \-\-mgf\-alg ,
3715 or SHA256 if neither is specified. Possible algorithms are:
3716 .BR SHA\-1 |\: SHA224 |\: SHA256 |\: SHA384 |\: SHA512 |\: SHA3\-224 |\: \
3717 SHA3\-256 |\: SHA3\-384 |\: SHA3\-512 .
3718 .
3719 .
3720 .
3721 .TP 8
3722 .BR \-\-mgf\-alg\~\fIMGF\-ALG\fP
3723 The mask generation function algorithm to use on the encoded block. The default
3724 is to use the same algorithm as specified with option
3725 .BR \-\-hash\-alg ,
3726 or SHA256 if neither is specified. Possible algorithms are:
3727 .BR SHA\-1 |\: SHA224 |\: SHA256 |\: SHA384 |\: SHA512 |\: SHA3\-224 |\: \
3728 SHA3\-256 |\: SHA3\-384 |\: SHA3\-512 .
3729 .
3730 .
3731 .
3732 .TP 8
3733 .BR \-\-source\-data\~\fISOURCE\-DATA\fP
3734 The source of the OAEP encoding parameter. Specify a hex string (not prefixed
3735 with 0x) of any number of bytes. The default is that no source data is used.
3736 .RE
3737 .PP
3738 .
3739 .
3740 .
3741 .SS OPTIONS FOR ARGUMENT \fIWRAP\-MECH\fB VALUE rsa\-aeskw:
3742 .
3743 .TP 8
3744 .BR \-\-aes\-key\-size\~\fIAES\-KEYBITS\fP
3745 The size of the temporary AES key in bits. The default is 256 bits. Possible
3746 key sizes are:
3747 .BR 128 | 192 | 256 .
3748 .
3749 .
3750 .
3751 .TP 8
3752 .BR \-\-hash\-alg\~\fIHASH\-ALG\fP
3753 The message digest algorithm used to calculate the digest of the OAEP encoding
3754 parameter. The default is to use the samealgorithm as specified with option
3755 .BR \-\-mgf\-alg ,
3756 or SHA256 if neither is specified. Possible algorithms are:
3757 .BR SHA\-1 |\: SHA224 |\: SHA256 |\: SHA384 |\: SHA512 |\: SHA3\-224 |\: \
3758 SHA3\-256 |\: SHA3\-384 |\: SHA3\-512 .
3759 .
3760 .
3761 .
3762 .TP 8
3763 .BR \-\-mgf\-alg\~\fIMGF\-ALG\fP
3764 The mask generation function algorithm to use on the encoded block. The default
3765 is to use the same algorithm as specified with option
3766 .BR \-\-hash\-alg ,
3767 or SHA256 if neither is specified. Possible algorithms are:
3768 .BR SHA\-1 |\: SHA224 |\: SHA256 |\: SHA384 |\: SHA512 |\: SHA3\-224 |\: \
3769 SHA3\-256 |\: SHA3\-384 |\: SHA3\-512 .
3770 .
3771 .
3772 .
3773 .TP 8
3774 .BR \-\-source\-data\~\fISOURCE\-DATA\fP
3775 The source of the OAEP encoding parameter. Specify a hex string (not prefixed
3776 with 0x) of any number of bytes. The default is that no source data is used.
3777 .RE
3778 .PP
3779 .
3780 .
3781 .
3782 .SS OPTIONS FOR ARGUMENT \fIWRAP\-MECH\fB VALUE ecdh\-aeskw, ecdh\-cof\-aeskw, \
3783 and ecdh\-x\-aeskw:
3784 .
3785 .TP 8
3786 .BR \-\-aes\-key\-size\~\fIAES\-KEYBITS\fP
3787 The size of the temporary AES key in bits. The default is 256 bits. Possible
3788 key sizes are:
3789 .BR 128 | 192 | 256 .
3790 .
3791 .
3792 .
3793 .TP 8
3794 .BR \-\-kdf\-alg\~\fIKDF\-ALG\fP
3795 The key derivation function algorithm used on the shared secret value to
3796 generate the internal AES key. The default is SHA256. Possible algorithms are:
3797 .BR SHA\-1 |\: SHA224 |\: SHA256 |\: SHA384 |\: SHA512 |\: SHA3\-224 |\: \
3798 SHA3\-256 |\: SHA3\-384 |\: SHA3\-512 |\: SHA\-1\-SP800 |\: SHA224\-SP800 |\: \
3799 SHA256\-SP800 |\: SHA384\-SP800 |\: SHA512\-SP800 |\: SHA3\-224\-SP800 |\: \
3800 SHA3\-256\-SP800 |\: SHA3\-384\-SP800 |\: SHA3\-512\-SP800 .
3801 .
3802 .
3803 .
3804 .TP 8
3805 .BR \-\-shared\-data\~\fISHARED\-DATA\fP
3806 Some data shared between the two parties. Specify a hex string (not prefixed
3807 with 0x) of any number of bytes. The default is that no shared data is used.
3808 .RE
3809 .PP
3810 .
3811 .
3812 .
3813 .SH "FILES"
3814 .
3815 .SS "/etc/opencryptoki/p11sak_defined_attrs.conf"
3816 .SS "~/.p11sak_defined_attrs.conf"
3817 In the output config file a user can define additional attributes, which are not
3818 mentioned in the PKCS#11 standard or are not known by the
3819 .B p11sak
3820 tool. A custom file path can be set with environment variable
3821 \fBP11SAK_DEFAULT_CONF_FILE\fP. If the environment variable is not set, then
3822 \fB.p11sak_defined_attrs.conf\fP is first tried to be read from the current
3823 user's home directory. If this is not available, the global
3824 \fB/etc/opencryptoki/p11sak_defined_attrs.conf\fP config file is read.
3825 If none of these files are available, a warning message is displayed, and
3826 printing of custom attributes is not available.
3827 .PP
3828 .
3829 .
3830 .
3831 .SH "ENVIRONMENT VARIABLES"
3832
3833 .SS "P11SAK_DEFAULT_CONF_FILE"
3834 A custom path for the \fBp11sak_defined_attrs.conf\fP config file can be set
3835 with the environment variable \fBP11SAK_DEFAULT_CONF_FILE\fP.
3836 If the environment variable is not set, then
3837 \fB.p11sak_defined_attrs.conf\fP is first tried to be read from the current
3838 user's home directory. If this is not available, the global
3839 \fB/etc/opencryptoki/p11sak_defined_attrs.conf\fP config file is read.
3840 If none of these files are available, a warning message is displayed, and
3841 printing of custom attributes is not available.
3842 .PP
3843 .
3844 .SS "PKCS11_USER_PIN"
3845 The token user PIN can be specified via the environment variable
3846 \fBPKCS11_USER_PIN\fP. If this environment variable is not set, and the option
3847 .BR \-\-pin | \-p
3848 .I PIN
3849 is not specified, p11sak prompts for the token user PIN interactively.
3850 .PP
3851 .
3852 .SS "PKCS11_SO_PIN"
3853 When option
3854 .B \-\-so
3855 is specified, the token SO PIN can be specified via the environment variable
3856 \fBPKCS11_SO_PIN\fP. If this environment variable is not set, and the option
3857 .BR \-\-pin | \-p
3858 .I PIN
3859 is not specified, p11sak prompts for the token SO PIN interactively.
3860 .PP
3861 .
3862 .SS "PKCSLIB"
3863 An alternative PKCS\~#11 library name can be specified with the \fBPKCSLIB\fP
3864 environment variable. If this environment variable is not set, then the default
3865 PKCS\~#11 library \fBlibopencryptoki.so\fP is used.
3866 .PP
3867 .
3868 .SS "P11SAK_PEM_PASSWORD"
3869 PEM files used for importing and exporting keys can be password protected.
3870 The PEM password can be specified via the environment variable
3871 \fBP11SAK_PEM_PASSWORD\fP. If this environment variable is not set, and the
3872 option
3873 .BR \-\-pem\-password | \-P
3874 .I PASSWORD
3875 is not specified, p11sak prompts for the PEM password interactively.
3876 .
3877 .
3878 .
3879 .SH "EXIT STATUS"
3880 The
3881 .B p11sak
3882 tool returns error codes as defined by the PKCS\~#11 standard, i.e. the
3883 \fBCKR_nnn\fP errors. On success, \fBCKR_OK\fP (which is zero) is returned.
3884 .PP
3885 The PKCS\~#11 error codes may originate from a PKCS\~#11 function called by the
3886 .B p11sak
3887 tool, or from the
3888 .B p11sak
3889 tool itself, like the following:
3890
3891 .SS CKR_ARGUMENTS_BAD (0x00000007):
3892 An argument, option or keyword is not valid.
3893 .PP
3894 .
3895 .
3896 .
3897 .SS CKR_DATA_INVALID (0x00000020):
3898 The \fBp11sak_defined_attrs.conf\fP cannot be parsed or its syntax is invalid.
3899 .PP
3900 .
3901 .
3902 .
3903 .SS CKR_MECHANISM_INVALID (0x00000070):
3904 The token does not support the key generation mechanism for the specified key
3905 type.
3906 .PP
3907 .
3908 .
3909 .
3910 .SS CKR_KEY_SIZE_RANGE (0x00000062):
3911 The token does not support the key size for the specified key type.
3912 .PP
3913 .
3914 .
3915 .
3916 .SS CKR_HOST_MEMORY (0x00000002):
3917 Allocating memory has failed.
3918 .PP
3919 .
3920 .
3921 .
3922 .SS CKR_FUNCTION_FAILED (0x00000006):
3923 A subfunction or library call has failed.
3924 .PP
3925 .
3926 .
3927 .
3928 .SS CKR_KEY_UNEXTRACTABLE (0x0000006A):
3929 A key has attribute
3930 .B CKA_EXTRACTABLE
3931 set to
3932 .B CK_FALSE
3933 and can thus not be wrapped or extracted otherwise.
3934 .PP
3935 .
3936 .
3937 .
3938 .SS CKR_KEY_NOT_WRAPPABLE (0x00000069):
3939 A key can not be wrapped, because the token does not support to wrap that
3940 key type with the used wrapping mechanism.
3941 .PP
3942 .
3943 .
3944 .
3945 .SH "SEE ALSO"
3946 .PD 0
3947 .TP
3948 \fBp11sak_defined_attrs.conf\fP(5)
3949 .PD