The p11sak tool supports various commands to generate, list, remove, update, import, and export token
keys and certificates in a PKCS #11 token repository.
Generatingsymmetricandasymmetrickeysp11sakgenerate-key|gen-key|genKEYTYPE [ARGUMENTS] [OPTIONS]
Use the generate-key|gen-key|gen command to generate a token key of the specified KEYTYPE with the
respective ARGUMENTS and OPTIONS. Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber. See below for a detailed description
of the arguments and options. The --help|-h option will also show the arguments and options available.
GeneratingDES/3DESkeysp11sakgenerate-key|gen-key|gendes|3des--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL--attr|-aATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|gen command with the des|3desKEYTYPE argument to generate a DES or 3DES key
(CKK_DES or CKK_DES3). The --label|-LLABEL option sets the CKA_LABEL attribute of the key and the
--attr|-aATTRS option can be used to set the boolean attributes of the key (see below for detailed
description of the attributes). The --id|-iID option can be used to set the value of the CKA_ID
attribute of the key.
Generatinggenericsecretkeysp11sakgenerate-key|gen-key|gengenericKEYBITS--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL--attr|-aATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|gengenericKEYBITS command and KEYTYPE argument to generate a generic
secret key (CKK_GENERIC_SECRET) with the key size in bits as specified by the KEYBITS argument.The
--label|-LLABEL option sets the CKA_LABEL attribute of the key and the --attr|-aATTRS option can be
used to set the boolean attributes of the key (see below for detailed description of the attributes). The
--id|-iID option can be used to set the value of the CKA_ID attribute of the key.
GeneratingAESkeysp11sakgenerate-key|gen-key|genaes128|192|256--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL--attr|-aATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|genaes128|192|256 command and KEYTYPE argument to generate a AES key
(CKK_AES) with 128-, 192-, or 256-bit length, respectively. The --label|-LLABEL option sets the
CKA_LABEL attribute of the key and the --attr|-aATTRS option can be used to set the boolean attributes
of the key (see below for detailed description of the attributes). The --id|-iID option can be used to
set the value of the CKA_ID attribute of the key.
GeneratingAES-XTSkeysp11sakgenerate-key|gen-key|genaes-xts128|256--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL--attr|-aATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|genaes-xts128|256 command and KEYTYPE argument to generate a AES-XTS key
(CKK_AES_XTS) with 128- or 256-bit length, respectively. The --label|-LLABEL option sets the CKA_LABEL
attribute of the key and the --attr|-aATTRS option can be used to set the boolean attributes of the key
(see below for detailed description of the attributes). The --id|-iID option can be used to set the
value of the CKA_ID attribute of the key.
GeneratingRSAkeysp11sakgenerate-key|gen-key|genrsa512|1024|2048|4096 [PUBL-EXP] --slot|-sSLOTID [--pin|-pPIN]
[--force-pin-prompt] [--no-login|-N] [--so] --label|-LLABEL|PUB-LABEL:PRIV-LABEL--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|genrsa1024|2048|4096 command and KEYTYPE argument to generate an 512-,
1024-, 2048-, or 4096-bit RSA key (CKK_RSA), respectively. The --label|-LLABEL|PUB-LABEL:PRIV-LABEL
option sets the CKA_LABEL attribute of the key and the --attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS option can be
used to set the boolean attributes of the key (see below for detailed description of the attributes).
Optionally, set individual key attributes for public and private key separated by a colon (:). The
--id|-iID option can be used to set the value of the CKA_ID attribute of the key. Furthermore, the
optional PUBL-EXP argument allows the user to specify the exponent used for generating the RSA key. The
default is set to 65537 according to the PKCS #11 standard.
GeneratingDHkeysp11sakgenerate-key|gen-key|gendhGROUP|DH-PARAM-PEM-FILE [PRIV-BITS] --slot|-sSLOTID [--pin|-pPIN]
[--force-pin-prompt] [--no-login|-N] [--so] --label|-LLABEL|PUB-LABEL:PRIV-LABEL--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|gendhGROUP|DH-PARAM-PEM-FILE command and KEYTYPE argument to generate a DH
key (CKK_DH), where GROUP specifies the Diffie-Hellman FFC group name or DH-PARAM-PEM-FILE specifies the
name of a DH parameters PEM file. The following arguments can be used for respective groups:
ffdhe2048|ffdhe3072|ffdhe4096|ffdhe6144|ffdhe8192|modp1536|modp2048|modp3072|modp4096|modp6144|modp8192Note: Not all groups are supported by all tokens and key generation will fail when the specified GROUP is
not supported. Also, not all groups are supported by all OpenSSL versions. If the p11sak tool is
compiled against an OpenSSL version that does not support certain groups, then those groups are not
accepted for the GROUP argument.
Alternatively, specify a DH parameters PEM file as DH-PARAM-PEM-FILE argument. You can for example
generate DH parameters using the OpenSSL command line tool as follows: 'openssldhparam<numbits>-out<pem-file>-outformPEM'. See the OpenSSL man page for details about this command.
The --label|-LLABEL|PUB-LABEL:PRIV-LABEL option sets the CKA_LABEL attribute of the key and the
--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS option can be used to set the boolean attributes of the key (see
below for detailed description of the attributes). Optionally, set individual key attributes for public
and private key separated by a colon (:). The --id|-iID option can be used to set the value of the
CKA_ID attribute of the key. Furthermore, the optional PRIV-BITS argument allows the user to specify the
size of the private key in bits.
GeneratingDSAkeysp11sakgenerate-key|gen-key|gendsaDSA-PARAM-PEM-FILE--slot|-sSLOTID [--pin|-pPIN]
[--force-pin-prompt] [--no-login|-N] [--so] --label|-LLABEL|PUB-LABEL:PRIV-LABEL--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|gendsaDSA-PARAM-PEM-FILE command and KEYTYPE argument to generate a DSA
key (CKK_DSA), where DSA-PARAM-PEM-FILE specifies the name of a DSA parameters PEM file. You can for
example generate DSA parameters using the OpenSSL command line tool as follows: 'openssldsaparam<numbits>-out<pem-file>-outformPEM'. See the OpenSSL man page for details about this command.
The --label|-LLABEL|PUB-LABEL:PRIV-LABEL option sets the CKA_LABEL attribute of the key and the
--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS option can be used to set the boolean attributes of the key (see
below for detailed description of the attributes). Optionally, set individual key attributes for public
and private key separated by a colon (:). The --id|-iID option can be used to set the value of the
CKA_ID attribute of the key.
GeneratingECkeysp11sakgenerate-key|gen-key|genecCURVE--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL|PUB-LABEL:PRIV-LABEL--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS
[--id|-iID] [--help|-h]
Use the generate-key|gen-key|genecCURVE command and KEYTYPE argument to generate an EC key (CKK_EC),
where CURVE specifies the elliptic curve used to create the EC key. The following arguments can be used
for respective curves:
prime256v1|prime192|secp224|secp384r1|secp521r1|secp265k1|brainpoolP160r1|brainpoolP160t1|brainpoolP192r1|brainpoolP192t1|brainpoolP224r1|brainpoolP224t1|brainpoolP256r1|brainpoolP256t1|brainpoolP320r1|brainpoolP320t1|brainpoolP384r1|brainpoolP384t1|brainpoolP512r1|brainpoolP512t1|curve25519|curve448|ed25519|ed448Note: Not all curves will be supported by all tokens and key generation will fail when the specified
CURVE is not supported.
The --label|-LLABEL|PUB-LABEL:PRIV-LABEL option sets the CKA_LABEL attribute of the key and the
--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS option can be used to set the boolean attributes of the key (see
below for detailed description of the attributes). Optionally, set individual key attributes for public
and private key separated by a colon (:). The --id|-iID option can be used to set the value of the
CKA_ID attribute of the key.
GeneratingIBMDilithiumkeysp11sakgenerate-key|gen-key|genibm-dilithiumVERSION--slot|-sSLOTID [--pin|-pPIN]
[--force-pin-prompt] [--no-login|-N] [--so] --label|-LLABEL|PUB-LABEL:PRIV-LABEL--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS [--id|-iID] [--help|-h]
Use the generate-key|gen-key|genibm-dilithiumVERSION command and KEYTYPE argument to generate an IBM
Dilithium key (CKK_IBM_PQC_DILITHIUM), where VERSION specifies the version of the IBM Dilithium keypair.
The following arguments can be used for respective keys: r2_65|r2_87|r3_44|r3_65|r3_87Note: Not all IBM Dilithium versions will be supported by all tokens and key generation will fail when
the specified VERSION is not supported.
The --label|-LLABEL|PUB-LABEL:PRIV-LABEL option sets the CKA_LABEL attribute of the key and the
--attr|-aATTRS can be used to set the boolean attributes of the key (see below for detailed description
of the attributes). Optionally, set individual key attributes for public and private key separated by a
colon (:). The --id|-iID option can be used to set the value of the CKA_ID attribute of the key.
GeneratingIBMKyberkeysp11sakgenerate-key|gen-key|genibm-kyberVERSION--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL|PUB-LABEL:PRIV-LABEL--attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS
[--id|-iID] [--help|-h]
Use the generate-key|gen-key|genibm-kyberVERSION command and KEYTYPE argument to generate an IBM Kyber
key (CKK_IBM_PQC_KYBER), where VERSION specifies the version of the IBM Kyber keypair. The following
arguments can be used for respective keys: r2_768|r2_1024Note: Not all IBM Kyber versions will be supported by all tokens and key generation will fail when the
specified VERSION is not supported.
The --label|-LLABEL|PUB-LABEL:PRIV-LABEL option sets the CKA_LABEL attribute of the key and the
--attr|-aATTRS can be used to set the boolean attributes of the key (see below for detailed description
of the attributes). Optionally, set individual key attributes for public and private key separated by a
colon (:). The --id|-iID option can be used to set the value of the CKA_ID attribute of the key.
Listingsymmetricandasymmetrickeysp11saklist-key|ls-key|ls [KEYTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt] [--no-login|-N]
[--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--long|-l] [--detailed-uri] [--hsm-mkvp|-m]
[--sort|-SSORT-SPEC] [--help|-h]
Use the list-key|ls-key|ls command and the optional KEYTYPE argument to list symmetric or asymmetric
keys. Public, private, secret, or all keys can also be listed irrespective of the key type.
Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|public|private|secret|all. If KEYTYPE
is omitted, then all key types are listed.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
keys to display. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
By default, the keys are listed in a short, tabular format showing only the boolean attributes, the key
type (CKA_KEY_TYPE) and the key label (CKA_LABEL). The attributes are denoted using the same single
letters as used with the --attr|-aATTRS|PUB-ATTRS:PRIV-ATTRS option. When option --long|-l is specified,
the keys are listed in long format, displaying the values of all attributes defined for the key type,
including non-boolean attributes. When option --hsm-mkvp|-m is specified, the HSM master key
verification patterns (MKVPs) of the keys are displayed. This is only possible for secure key tokens,
such as the CCA and EP11 tokens.
By default, the keys are displayed in the order as they are retrieved from the PKCS #11 implementation.
To display the keys in a certain order, specify the --sort|-SSORT-SPEC option. You can sort the keys by
label, key type, object class, and/or key size. For details, see the description of the --sort|-SSORT-SPEC option below.
Deletingsymmetricandasymmetrickeysp11sakremove-key|rm-key|rm [KEYTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--long|-l] [--force|-f]
[--help|-h]
Use the remove-key|rm-key|rm command and the optional KEYTYPE argument to remove symmetric or asymmetric
keys. Public, private, secret, or all keys can also be selected for removal irrespective of the key type.
Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|public|private|secret|all. If KEYTYPE
is omitted, then all key types are selected for removal.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
keys to remove. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
The user will be prompted to confirm the removal of the key. To suppress the prompt, use the --force|-f
option.
Settingorupdatingattributesofsymmetricandasymmetrickeysp11sakset-key-attr|set-key|set [KEYTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] [--new-attr|-AATTRS] [--new-label|-lLABEL] [--new-id|-IID] [--help|-h]
Use the set-key-attrs|set-key|set command and the optional KEYTYPE argument to set or update boolean
attributes of symmetric or asymmetric keys. Public, private, secret, or all keys can also be selected
for updating irrespective of the key type.
Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|public|private|secret|all. If KEYTYPE
is omitted, then all key types are selected for updating.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
keys to set or update. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
Use the --new-attr|-AATTRS option to specify the boolean attributes of the key you want to update (see
below for detailed description of the attributes). Attributes that are not specified are not changed. Use
the --new-label|-lLABEL option to specify the new label, or the --new-id|-IID option to specify the new
ID to set for the key. At least one of the --new-attr|-AATTRS, --new-label|-lLABEL, or --new-id|-IID
options must be specified.
The user will be prompted to confirm the updating of the key. To suppress the prompt, use the --force|-f
option.
Coypingsymmetricandasymmetrickeysp11sakcopy-key|copy|cp [KEYTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt] [--no-login|-N]
[--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] [--new-attr|-AATTRS]
[--new-label|-lLABEL] [--new-id|-IID] [--help|-h]
Use the copy-key|copy|cp command and the optional KEYTYPE argument to copy symmetric or asymmetric
keys and optionally set or change boolean attributes, the label, or ID of the copied keys. Public,
private, secret, or all keys can also be copied irrespective of the key type.
Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|public|private|secret|all. If KEYTYPE
is omitted, then all key types are selected for copying.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
keys to copy. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard character
that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?). Also, a
backslash character that should not be treated as an escape character must be escaped (\\). The ID must
be specified as hex string (not prefixed with 0x) of any number of bytes.
Use the --new-attr|-AATTRS option to specify the boolean attributes of the copied key you want to set or
update (see below for detailed description of the attributes). Attributes that are not specified are not
changed. Use the --new-label|-lLABEL option to specify the new label, or the --new-id|-IID option to
specify the new ID to set for the copied key.
The user will be prompted to confirm the copying of the key. To suppress the prompt, use the --force|-f
option.
Importingsymmetricandasymmetrickeysfromafilep11sakimport-key|import|impKEYTYPE [KIND] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL [--id|-iID] [--force|-f] [--attr|-aATTRS] --file|-FFILENAME
[--pem-password|-PPASSWORD] [--force-pem-pwd-prompt] [--opaque|-o] [--oqsprovider-pem] [--help|-h]
Use the import-key|import|imp command and KEYTYPE argument to import an symmetric or asymmetric key from
a file. When importing an asymmetric key, the KIND argument is required and specifies to either import a
private or public key.
Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|public|private|secret|all.
The --label|-LLABEL option sets the CKA_LABEL attribute of the key and the --attr|-aATTRS can be used
to set the boolean attributes of the key (see below for detailed description of the attributes). The
--id|-iID option can be used to set the value of the CKA_ID attribute of the key.
The --file|-FFILENAME option specifies the file name of the file that contains the key to be imported.
For symmetric keys, this is a binary file containing the key material in clear. For asymmetric keys,
this is an OpenSSL PEM file containing a public or private key. PEM files can optionally be password
protected. Specify the PEM password with the --pem-password|-PPASSWORD option or environment variable
P11SAK_PEM_PASSWORD. If the PEM file is password protected, but no PEM password is specified, you will
be prompted for the PEM password. Specify the --opaque|-o option to import an opaque secure key blob.
Not all tokens support this.
Specify the --oqsprovider-pem option when the key material in the PEM file is in the oqsprovider format.
This option is only valid for the ibm-dilithium keytype. PEM files in oqsprovider format are only
supported when the oqsprovider from https://github.com/open-quantum-safe/oqs-provider has been configured
with OpenSSL 3.0 or later. This is an experimental feature, it may change in an incompatible way in the
future!
Exportingsymmetricandasymmetrickeystoafilep11sakexport-key|export|exp [KEYTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] --file|-FFILENAME
[--opaque|-o] [--spki|-S] [--uri-pem|-u] [--uri-pin-value] [--uri-pin-sourceFILENAME]
[--oqsprovider-pem] [--help|-h]
Use the export-key|export|exp command and the optional KEYTYPE argument to export symmetric or asymmetric
keys to a file. Public, private, secret, or all keys can also be selected for export irrespective of the
key type.
Possible values for the KEYTYPE argument are:
des|3des|generic|aes|aes-xts|rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|public|private|secret|all. If KEYTYPE
is omitted, then all key types are selected for export.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
keys to export. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
The --file|-FFILENAME option specifies the file name of the file to which the keys to be exported are
written to. For symmetric keys, this is a binary file where the key material in clear is written to. For
asymmetric keys, this is an OpenSSL PEM file where the public or private keys are written to. If multiple
asymmetric keys match the filter, the keys are appended to the PEM file specified with the --file|-FFILENAME option. If multiple symmetric keys or a mixture of asymmetric and symmetric keys match the
filter, then you are prompted to confirm to overwrite the previously created file, unless the
[--force|-f] option is specified.
Specify the --opaque|-o option to export the opaque secure key blobs of the key. Not all tokens support
this.
Specify the --spki|-S option to export the Subject Public Key Info (SPKI) from the CKA_PUBLIC_KEY_INFO
attribute of an asymmetric private key instead of its private key material. This option can only be used
with private keys.
Specify the --oqsprovider-pem option when the key material is to be exported in oqsprovider format into
the PEM file. This option is only valid for the ibm-dilithium keytype. PEM files in oqsprovider format
are only supported when the oqsprovider from https://github.com/open-quantum-safe/oqs-provider has been
configured with OpenSSL 3.0 or later. This is an experimental feature, it may change in an incompatible
way in the future!
Note: Not all keys can be exported, because its attribute setting may forbid to reveal the values of
certain attributes. To allow exporting of a secret (CKO_SECRET_KEY) or private (CKO_PRIVATE_KEY) key,
attribute CKA_SENSITIVE must be CK_FALSE and attribute CKA_EXTRACTABLE must be CK_TRUE. Secret or
private keys that contain an opaque secure key blob (attribute CKA_IBM_OPAQUE) can also not be exported
in clear, even if the attributes would allow it. For such keys only the opaque secure key blob can be
exported by using the --opaque|-o option.
Specify the --uri-pem|-u option to export the PKCS#11 URI of the key in PEM form instead of the key
material. Such an URI-PEM file can then be used with the pkcs11-provider from
https://github.com/latchset/pkcs11-provider. By default, the PKCS#11 URI does not contain the PKCS#11
user pin. Specify option --uri-pin-value to include the PKCS#11 user pin in the URI using the pin-value
query attribute. This reveals the PKCS#11 user pin in clear, use with care! Alternatively, specify
option --uri-pin-sourceFILENAME to include the pin-source query attribute in the URI, referencing the
file name specified with this option. The PKCS#11 user pin value is written into that file as part of the
export operation. This reveals the PKCS#11 user pin in clear, use with care! Adjust the file permissions
of the specified pin-source file so that it can only be read by the desired user(s). By default the file
permissions are set so that only the owner user can read and write that file, but no one else (i.e.
0600).
Extractingthepublickeyofprivatekeyobjectsp11sakextract-pubkey|extr-pubkey|expub [KEYTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--new-attr|-AATTRS]
[--new-label|-lLABEL] [--new-id|-IID] [--force|-f] [--help|-h]
Use the extract-pubkey|extr-pubkey|expub command and the optional KEYTYPE argument to extract the public
key from private key objects and save it as new token object.
Possible values for the KEYTYPE argument are: rsa|dh|dsa|ec|ibm-dilithium|ibm-kyber|private|all. If
KEYTYPE is omitted, then all private key types are selected for export.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the private
keys of which the public keys are to be extracted. You can use wildcards (* and ?) in the LABEL
specification. To specify a wildcard character that should not be treated as a wildcard, it must be
escaped using a backslash (\* or \?). Also, a backslash character that should not be treated as an
escape character must be escaped (\\). The ID must be specified as hex string (not prefixed with 0x) of
any number of bytes.
Use the --new-attr|-AATTRS option to specify the boolean attributes of the public key object you want to
set (see below for detailed description of the attributes). Use the --new-label|-lLABEL option to
specify the new label. If no new label is specified, the label of the public key object is derived from
the private key label by appending _pubkey.
Use the --new-id|-IID option to set an ID for the extracted public key object.
The user will be prompted to confirm the extraction of the public key from the private key objects. To
suppress the prompt, use the --force|-f option.
Listingcertificatesp11saklist-cert|ls-cert|lsc [CERTTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--long|-l] [--detailed-uri]
[--sort|-SSORT-SPEC] [--help|-h]
Use the list-cert|ls-cert|lsc command and the optional CERTTYPE argument to list certificates.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, then x509 certificates are
listed by default, because no other certificate types are supported.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
certificates to display. You can use wildcards (* and ?) in the LABEL specification. To specify a
wildcard character that should not be treated as a wildcard, it must be escaped using a backslash (\* or
\?). Also, a backslash character that should not be treated as an escape character must be escaped (\\).
The ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
By default, the certificates are listed in a short, tabular format showing only the boolean attributes,
the certificate type (CKA_CERTIFICATE_TYPE) and the certificate label (CKA_LABEL). The attributes are
denoted using the same single letters as used with the --attr|-aATTRS option. When option --long|-l is
specified, the certificates are listed in long format, displaying the values of all attributes defined
for the certificate type, including non-boolean attributes.
By default, the certificates are displayed in the order as they are retrieved from the PKCS #11
implementation. To display the certificates in a certain order, specify the --sort|-SSORT-SPEC option.
You can sort the certificates by label and/or subject common name (CN). For details, see the description
of the --sort|-SSORT-SPEC option below.
Deletingcertificatesp11sakremove-cert|rm-cert|rmc [CERTTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] [--help|-h]
Use the remove-cert|rm-cert|rmc command and the optional CERTTYPE argument to remove certificates from
the repository.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, then x509 is used by
default, because no other certificate types are supported.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
certificates to remove. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
The user will be prompted to confirm the removal of the certificate. To suppress the prompt, use the
--force|-f option.
Settingorupdatingattributesofcertificatesp11sakset-cert-attr|set-cert|setc [CERTTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] [--new-attr|-AATTRS] [--new-label|-lLABEL] [--new-id|-IID] [--help|-h]
Use the set-cert-attrs|set-cert|sect command and the optional CERTTYPE argument to set or update
boolean attributes of certificates.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, x509 is used by default,
because no other certificate types are supported.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
certificates to set or update. You can use wildcards (* and ?) in the LABEL specification. To specify a
wildcard character that should not be treated as a wildcard, it must be escaped using a backslash (\* or
\?). Also, a backslash character that should not be treated as an escape character must be escaped (\\).
The ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
Use the --new-attr|-AATTRS option to specify the boolean attributes of the certificate you want to
update (see below for detailed description of the attributes). Attributes that are not specified are not
changed. Use the --new-label|-lLABEL option to specify the new label, or the --new-id|-IID option to
specify the new ID to set for the certificate. At least one of the --new-attr|-AATTRS, --new-label|-lLABEL, or --new-id|-IID options must be specified.
The user will be prompted to confirm the updating of the certificate. To suppress the prompt, use the
--force|-f option.
Coypingcertificatesp11sakcopy-cert|copyc|cpc [CERTTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] [--new-attr|-AATTRS] [--new-label|-lLABEL] [--new-id|-IID] [--help|-h]
Use the copy-cert|copyc|cpc command and the optional CERTTYPE argument to copy certificates and
optionally set or change boolean attributes, the label, or ID of the copied certificates.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, then x509 is used by
default, because no other certificate type is supported.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
certificates to copy. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
Use the --new-attr|-AATTRS option to specify the boolean attributes of the copied certificates you want
to set or update (see below for detailed description of the attributes). Attributes that are not
specified are not changed. Use the --new-label|-lLABEL option to specify the new label, or the
--new-id|-IID option to specify the new ID to set for the copied certificate.
The user will be prompted to confirm the copying of the certificate. To suppress the prompt, use the
--force|-f option.
Importingx.509certificatesfromafilep11sakimport-cert|importc|impcCERTTYPE--slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] --label|-LLABEL [--id|-iID] [--attr|-aATTRS] --file|-FFILENAME [--ca-cert|-C]
[--help|-h]
Use the import-cert|importc|impc command and CERTTYPE argument to import an x.509 certificate from a
file.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, then x509 is used by
default, because no other certificate type is supported.
The --label|-LLABEL option sets the CKA_LABEL attribute of the certificate and the --attr|-aATTRS can
be used to set the boolean attributes of the certificate (see below for detailed description of the
attributes. Applicable attributes for certificates are P M B Y T). The --id|-iID option can be used to
set the value of the CKA_ID attribute of the certificate.
The --file|-FFILENAME option specifies the file name of the file that contains the certificate to be
imported. Supported input formats are PEM and binary (DER-encoded). The format is automatically detected.
The --ca-cert|-C option flags the certificate as a Certificate Authority (CA) certificate. If the
certificate has the BasicConstraintsCA flag on, it is also flagged as Certificate Authority (CA)
certificate.
Exportingcertificatestoafilep11sakexport-cert|exportc|expc [CERTTYPE] --slot|-sSLOTID [--pin|-pPIN] [--force-pin-prompt]
[--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS] [--force|-f] --file|-FFILENAME
[--der|-D] [--uri-pem|-u] [--uri-pin-value] [--uri-pin-sourceFILENAME] [--help|-h]
Use the export-cert|exportc|expc command and the optional CERTTYPE argument to export x.509 public key
certificates to a file.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, then x509 is used by
default, because no other certificate types are supported.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the list of
certificates to export. You can use wildcards (* and ?) in the LABEL specification. To specify a wildcard
character that should not be treated as a wildcard, it must be escaped using a backslash (\* or \?).
Also, a backslash character that should not be treated as an escape character must be escaped (\\). The
ID must be specified as hex string (not prefixed with 0x) of any number of bytes.
The --file|-FFILENAME option specifies the file name of the file to which the certificates to be
exported are written to. This can be an OpenSSL PEM file or binary (DER-encoded) file. If it's a PEM
file, multiple certificates can be exported to the same file. If it's a binary file, each subsequent
export will overwrite the previous data in the output file. You are prompted to confirm to overwrite the
previously created file, unless the [--force|-f] option is specified.
Specify the --der|-D option to export the certificate(s) in binary (DER-encoded) form. Default is PEM
format.
Specify the --uri-pem|-u option to export the PKCS#11 URI of the certificate in PEM form instead of the
certificate material. Such an URI-PEM file can then be used with the pkcs11-provider from
https://github.com/latchset/pkcs11-provider. By default, the PKCS#11 URI does not contain the PKCS#11
user pin. Specify option --uri-pin-value to include the PKCS#11 user pin in the URI using the pin-value
query attribute. This reveals the PKCS#11 user pin in clear, use with care! Alternatively, specify
option --uri-pin-sourceFILENAME to include the pin-source query attribute in the URI, referencing the
file name specified with this option. The PKCS#11 user pin value is written into that file as part of the
export operation. This reveals the PKCS#11 user pin in clear, use with care! Adjust the file permissions
of the specified pin-source file so that it can only be read by the desired user(s). By default the file
permissions are set so that only the owner user can read and write that file, but no one else (i.e.
0600).
Extractingthepublickeyofcertificatesp11sakextract-cert-pubkey|extrc-pubkey|excpub [CERTTYPE] --slot|-sSLOTID [--pin|-pPIN]
[--force-pin-prompt] [--no-login|-N] [--so] [--label|-LLABEL] [--id|-iID] [--attr|-aATTRS]
[--new-attr|-AATTRS] [--new-label|-lLABEL] [--new-id|-IID] [--force|-f] [--help|-h]
Use the extract-cert-pubkey|extrc-pubkey|excpub command and the optional CERTTYPE argument to extract the
public key from certificates and save it as new token object.
Possible values for the CERTTYPE argument are: x509. If CERTTYPE is omitted, then x509 is used by
default, because no other certificate types are supported.
Specify the --label|-LLABEL, the --id|-iID, and/or the --attr|-aATTRS options to filter the
certificates of which the public keys are to be extracted. You can use wildcards (* and ?) in the LABEL
specification. To specify a wildcard character that should not be treated as a wildcard, it must be
escaped using a backslash (\* or \?). Also, a backslash character that should not be treated as an
escape character must be escaped (\\). The ID must be specified as hex string (not prefixed with 0x) of
any number of bytes.
Use the --new-attr|-AATTRS option to specify the boolean attributes of the public key object you want to
set (see below for detailed description of the attributes). Use the --new-label|-lLABEL option to
specify the new label. If no new label is specified, the label of the public key object is derived from
the certificate label by appending _pubkey.
Use the --new-id|-IID option to set an ID for the extracted public key object.
The user will be prompted to confirm the extraction of the public key from the certificate. To suppress
the prompt, use the --force|-f option.