| 1 |
.TH P11KMIP 1 "August 2023" "@PACKAGE_VERSION@" "openCryptoki" |
| 2 |
.SH NAME |
| 3 |
p11kmip \- Transfer cryptographic keys between PKCS\~#11 and KMIP. |
| 4 |
. |
| 5 |
. |
| 6 |
. |
| 7 |
.SH SYNOPSIS |
| 8 |
.B p11kmip |
| 9 |
.I command |
| 10 |
.RB [ OPTIONS ] |
| 11 |
.PP |
| 12 |
. |
| 13 |
.B p11kmip |
| 14 |
.BR \-\-help | \-h |
| 15 |
.br |
| 16 |
.B p11kmip |
| 17 |
.BR \-\-version | \-v |
| 18 |
. |
| 19 |
. |
| 20 |
. |
| 21 |
.SH DESCRIPTION |
| 22 |
The \fBp11kmip\fP tool can be used to transfer target keys between a PKCS\~#11 |
| 23 |
key repository and a KMIP server. Target keys may be imported or exported, and |
| 24 |
are wrapped using public-key cryptography during transit. Keys used for |
| 25 |
wrapping may also be sent and received. Only AES keys are supported as |
| 26 |
target keys, and only RSA is supported for key wrapping. |
| 27 |
.PP |
| 28 |
.SS KMIP CLIENT AUTHENTICATION |
| 29 |
KMIP authenticates the users with the client certificate exchanged during TLS |
| 30 |
handshake. Thus, the client must generate a private RSA or EC key and a client |
| 31 |
certificate. The client certificate must be registered with the KMIP server. |
| 32 |
This is a KMIP server product-specific out-of-band process, which is not |
| 33 |
described here. The client certificate can be a self-signed certificate or a |
| 34 |
CA-signed certificate. In a production environment, use a CA-signed certificate. |
| 35 |
.PP |
| 36 |
The client private key identifies the client to the KMIP server, and thus |
| 37 |
must be kept secret. If the client private key gets stolen by an attacker |
| 38 |
then the attacker can identify itself at the KMIP server and thus gets access |
| 39 |
to the keys stored in the KMIP server. |
| 40 |
.PP |
| 41 |
.SS USING A CLEAR CLIENT KEY |
| 42 |
You can generate the client private key with OpenSSL command line tools. In |
| 43 |
this case, the private key is a clear key stored in a PEM file. |
| 44 |
For security reasons, store the client private key in a password-protected |
| 45 |
PEM file. See an example on how to create a password-protected client key and |
| 46 |
a self-signed certificate using OpenSSL commands: |
| 47 |
.PP |
| 48 |
\fB |
| 49 |
openssl genpkey \-algorithm RSA \-pkeyopt rsa_keygen_bits:2048 \\ |
| 50 |
\-out '/path_to_client_key/client.key' \-pass stdin \\ |
| 51 |
\-aes\-256\-cbc |
| 52 |
\fP |
| 53 |
.PP |
| 54 |
If you want to generate an EC key instead, use \fB\-algorithm EC\fP and |
| 55 |
\fB\-pkeyopt ec_paramgen_curve:<curve-name>\fP. Create a self-signed certificate |
| 56 |
with the just generated client key as follows: |
| 57 |
.PP |
| 58 |
\fB |
| 59 |
openssl req \-x509 \-key '/path_to_client_key/client.key' \\ |
| 60 |
\-out '/path_to_client_certificate/selfsigned_client.crt' \\ |
| 61 |
\-nodes \-days 3650 \\ |
| 62 |
\-subj '/CN=www.mydom.com/O=My Company Name LTD./C=US' |
| 63 |
\fP |
| 64 |
.PP |
| 65 |
When using a password-protected client key PEM file, then you are prompted |
| 66 |
for the PEM password. You are also prompted for further information for the |
| 67 |
certificate to create, unless these details are supplied via the OpenSSL config |
| 68 |
file. Refer to the man page of the \fBopenssl req\fP command for further |
| 69 |
details. |
| 70 |
.PP |
| 71 |
If you want to generate a CA-signed certificate instead, omit the \fB\-x509\fP |
| 72 |
option. Thus, the command generates a certificate signing request instead, that |
| 73 |
you pass to the CA. With this request, you let the CA sign the certificate and |
| 74 |
issue a CA-signed certificate for you. |
| 75 |
.PP |
| 76 |
.SS USING AN HSM-PROTECTED CLIENT KEY |
| 77 |
A more secure way to protect the client private key is to generate and store the |
| 78 |
client key inside a PKCS#11 token. If a secure key token, such as a CCA or |
| 79 |
EP11 token, is used then the client private key is HSM protected and can not be |
| 80 |
stolen. This requires the use of a PKCS#11 OpenSSL provider (with OpenSSL 3.0.0 |
| 81 |
or later), that is, the \fBpkcs11\-provider\fP from |
| 82 |
\fBhttps://github.com/latchset/pkcs11\-provider\fP. The PKCS#11 provider must |
| 83 |
be installed and configured properly to allow access to openCryptoki. Use an |
| 84 |
OpenSSL configuration file similar to the following: |
| 85 |
.PP |
| 86 |
\fB |
| 87 |
[openssl_init] |
| 88 |
providers = provider_sect |
| 89 |
|
| 90 |
[provider_sect] |
| 91 |
default = default_sect |
| 92 |
pkcs11 = pkcs11_sect |
| 93 |
|
| 94 |
[default_sect] |
| 95 |
activate = 1 |
| 96 |
|
| 97 |
[pkcs11_sect] |
| 98 |
pkcs11\-module\-path = /path/to/libopencryptoki.so |
| 99 |
activate = 1 |
| 100 |
\fP |
| 101 |
.PP |
| 102 |
.PP |
| 103 |
Generate an RSA client key pair in a PKCS#11 token: |
| 104 |
.PP |
| 105 |
\fB |
| 106 |
p11sak generate\-key rsa 2048 \-\-label '<name-of-client-key>' \-\-slot <n> |
| 107 |
\fP |
| 108 |
.PP |
| 109 |
If you want to generate an EC key instead, use: |
| 110 |
.PP |
| 111 |
\fB |
| 112 |
p11sak generate\-key EC <curve-name> \-\-label '<name-of-client-key>' \-\-slot <n> |
| 113 |
\fP |
| 114 |
.PP |
| 115 |
Then export the private client key as a URI-PEM file. A URI-PEM file contains |
| 116 |
a PKCS#11 URI referencing the key in the PKCS#11 token, but no key material. |
| 117 |
By default, the PKCS#11 URI does not contain the PKCS#11 user PIN. Refer to the |
| 118 |
man page of \fBp11sak\fP(1) and option \fB\-\-uri\-pem\fP for details about how |
| 119 |
to include the PKCS#11 user PIN or a PIN source into the URI. |
| 120 |
.PP |
| 121 |
\fB |
| 122 |
p11sak export\-key \-\-label '<name-of-client.key>:prv' \-\-uri\-pem \\ |
| 123 |
\-\-file '/path_to_client_key/client.key' \\ |
| 124 |
\-\-slot <n>> |
| 125 |
\fP |
| 126 |
.PP |
| 127 |
With that private client key as URI-PEM file you can create a self-signed |
| 128 |
certificate using the following OpenSSL command: |
| 129 |
.PP |
| 130 |
\fB |
| 131 |
openssl req \-x509 \-key '/path_to_client_key/client.key' \\ |
| 132 |
\-out '/path_to_client_certificate/selfsigned_client.crt' \\ |
| 133 |
\-nodes \-days 3650 \\ |
| 134 |
\-subj '/CN=www.mydom.com/O=My Company Name LTD./C=US' |
| 135 |
\fP |
| 136 |
.PP |
| 137 |
You are prompted for the PKCS#11 user PIN, unless the user PIN is contained in |
| 138 |
the PKCS#11 URI. You are also prompted for further information for the |
| 139 |
certificate to create, unless these details are supplied via the OpenSSL config |
| 140 |
file. Refer to the man page of the \fBopenssl req\fP command for further |
| 141 |
details. |
| 142 |
.PP |
| 143 |
If you want to generate a CA-signed certificate instead, omit the \fB\-x509\fP |
| 144 |
option. Thus, the command generates a certificate signing request instead, that |
| 145 |
you pass to the CA. With this request, you let the CA sign the certificate and |
| 146 |
issue a CA-signed certificate for you. |
| 147 |
.PP |
| 148 |
Instead of using an URI-PEM file, you can also use the PKCS#11 URI directly. Use |
| 149 |
the \fBp11sak list\-key\fP command with the \fB\-\-long\fP option to display |
| 150 |
the PKCS#11 URI of the client private key object. Then specify this URI as-is |
| 151 |
at the \fB\-key\fP option of the \fBopenssl req\fP command from above: |
| 152 |
.PP |
| 153 |
\fB |
| 154 |
openssl req \-x509 \-key 'pkcs11:....;type=private' \\ |
| 155 |
\-out '/path_to_client_certificate/selfsigned_client.crt' \\ |
| 156 |
\-nodes \-days 3650 \\ |
| 157 |
\-subj '/CN=www.mydom.com/O=My Company Name LTD./C=US' |
| 158 |
\fP |
| 159 |
.PP |
| 160 |
There is no need to export the client private key as URI-PEM file in this case. |
| 161 |
.PP |
| 162 |
.SS USING THE CLIENT KEY AND CERTIFICATE WITH P11KMIP |
| 163 |
Use the private client key as URI-PEM (\fB'/path_to_client_key/client.key'\fP) |
| 164 |
or as PKCS#11 URI (\fB'pkcs11:....;type=private'\fP) and the client certificate |
| 165 |
(\fB'/path_to_client_certificate/selfsigned_client.crt'\fP) |
| 166 |
with the \fBp11kmip\fP commands described below. You can specify the client key |
| 167 |
and client certificate using options \fB\-\-kmip\-client\-key\fP and |
| 168 |
\fB\-\-kmip\-client\-cert\fP, or in the \fB/etc/opencryptoki/p11kmip.conf\fP |
| 169 |
configuration file, or via environment variables. |
| 170 |
.PP |
| 171 |
When using a URI-PEM file, or a password-protected PEM file as client key, then |
| 172 |
you are prompted for the PKCS#11 user PIN or the PEM password when the |
| 173 |
\fBp11kmip\fP tool reads the client key PEM file, unless the PEM password is |
| 174 |
specified using the \fB\-\-pem\-password\fP option. The prompt looks like this: |
| 175 |
.PP |
| 176 |
\fB |
| 177 |
Please enter PEM password for '/path_to_client_key/client.key': |
| 178 |
\fP |
| 179 |
.PP |
| 180 |
Note that the prompt message is the same when using a URI-PEM file, and it is |
| 181 |
prompting for the PKCS#11 user PIN. For a URI-PEM file, the PEM password is the |
| 182 |
PKCS#11 user PIN required to access the PKCS#11 token that contains the key |
| 183 |
the URI is referring to. |
| 184 |
.PP |
| 185 |
If you specify a PKCS#11 URI directly as client private key, then you are |
| 186 |
explicitely prompted for the PKCS#11 user PIN for the specified URI. |
| 187 |
. |
| 188 |
. |
| 189 |
. |
| 190 |
.SH COMMANDS |
| 191 |
The \fBp11kmip\fP tool supports commands to import and export keys between |
| 192 |
a PKCS\~#11 token repository and KMIP server. |
| 193 |
.PP |
| 194 |
.SS "Importing target keys" |
| 195 |
.B p11kmip |
| 196 |
.BR import\-key | import | imp |
| 197 |
.BR \-\-targkey\-label | \-t |
| 198 |
.I TARGKEY\-LABEL |
| 199 |
.BR \-\-wrapkey\-label | \-w |
| 200 |
.I WRAPKEY\-LABEL |
| 201 |
.RB [ \-\-unwrapkey\-label | \-u |
| 202 |
.IR UNWRAPKEY\-LABEL ] |
| 203 |
.RB [ \-\-send\-wrapkey ] |
| 204 |
.RB [ \-\-targkey\-attrs |
| 205 |
.IR TARGKEY\-ATTRS ] |
| 206 |
.RB [ \-\-targkey\-id |
| 207 |
.IR ID ] |
| 208 |
.RB [ \-\-gen\-targkey ] |
| 209 |
.RB [ \-\-targkey\-length |
| 210 |
.IR LENGTH ] |
| 211 |
.RB [ OPTIONS ] |
| 212 |
.PP |
| 213 |
Use the |
| 214 |
.BR import\-key |
| 215 |
command to import a target key located on a KMIP server to a |
| 216 |
PKCS\~#11 token repository. Importing a key from a KMIP server requires a wrapping key present on |
| 217 |
the server with its corresponding unwrapping key present in a local PKCS\#11 slot. |
| 218 |
Currently RSA is supported for wrapping and unwrapping keys and AES is supported for |
| 219 |
target keys. |
| 220 |
|
| 221 |
The |
| 222 |
.BR \-\-targkey\-label | \-t |
| 223 |
.I TARGKEY\-LABEL |
| 224 |
option specifies the KMIP name attribute of the target key to be imported. |
| 225 |
Once imported into the PKCS\~#11 token repository, the |
| 226 |
.B CKA_LABEL |
| 227 |
attribute of the target key will be set to the same value as |
| 228 |
.IR TARGKEY\-LABEL . |
| 229 |
The |
| 230 |
.BR \-\-wrapkey\-label | \-w |
| 231 |
.I WRAPKEY\-LABEL |
| 232 |
option specifies the KMIP name attribute of the key to be used for wrapping. |
| 233 |
This wrapping key must already be present on the KMIP server, unless the |
| 234 |
.BR \-\-send\-wrapkey |
| 235 |
option is specified. |
| 236 |
|
| 237 |
The imported key will be unwrapped using a corresponding unwrapping key |
| 238 |
located in the PKCS\~#11 token repository with a |
| 239 |
.B CKA_LABEL |
| 240 |
attribute value that is the same as |
| 241 |
.I WRAPKEY\-LABEL |
| 242 |
, unless the |
| 243 |
.B \-\-unwrapkey\-label | \-u |
| 244 |
.I UNWRAPKEY\-LABEL |
| 245 |
option identifies a different private key instead. |
| 246 |
|
| 247 |
When the |
| 248 |
.BR \-\-send\-wrapkey |
| 249 |
option is specified, the |
| 250 |
.BR \-\-wrapkey\-label | \-w |
| 251 |
.I WRAPKEY\-LABEL |
| 252 |
option will instead be used to identify a public key |
| 253 |
located in the PKCS\~#11 token repository, with a |
| 254 |
.B CKA_LABEL |
| 255 |
attribute value that is the same as specified by |
| 256 |
.IR WRAPKEY\-LABEL . |
| 257 |
This public key is sent and registered on the KMIP server with a KMIP name |
| 258 |
specified by |
| 259 |
.BR \-\-wrapkey\-label . |
| 260 |
The public key will then be used for wrapping. |
| 261 |
|
| 262 |
After the import operation has been completed successfully, information will be displayed |
| 263 |
about the keys involved. This includes the |
| 264 |
.B CKA_LABEL |
| 265 |
attribute values of the imported target key and wrapping key, the KMIP UID attributes |
| 266 |
of both keys, and a SHA-256 digest of the imported target key from both the KMIP server and the |
| 267 |
PKCS\~#11 token repository. |
| 268 |
|
| 269 |
Example: |
| 270 |
Target Key |
| 271 |
PKCS#11 Label...TARGET_KEY_LABEL |
| 272 |
PKCS#11 Digest..FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
| 273 |
KMIP UID........TARGET_KEY_UUID |
| 274 |
KMIP Digest.....AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 275 |
Wrapping Key |
| 276 |
PKCS#11 Label...WRAPPING_KEY_LABEL |
| 277 |
KMIP UID........WRAPPING_KEY_UUID |
| 278 |
|
| 279 |
The |
| 280 |
.B \-\-targkey\-attrs |
| 281 |
.I TARGKEY\-ATTRS |
| 282 |
option can be used to set the boolean attributes of the imported target key |
| 283 |
(see below for detailed description of the attributes). The |
| 284 |
.B \-\-targkey\-id |
| 285 |
.I ID |
| 286 |
option may be used to set the value of the |
| 287 |
.BR CKA_ID |
| 288 |
attribute of the target key. |
| 289 |
|
| 290 |
When the |
| 291 |
.BR \-\-gen\-targkey |
| 292 |
option is specified, the target key will first be generated on the |
| 293 |
KMIP server. In this case, the value of the |
| 294 |
.BR \-\-targkey\-label | \-t |
| 295 |
.I TARGKEY\-LABEL |
| 296 |
option will be used as the KMIP name attribute of the generated key. |
| 297 |
Currently, only AES symmetric keys may be generated in this way. |
| 298 |
|
| 299 |
The |
| 300 |
.B \-\-targkey\-length |
| 301 |
.I LENGTH |
| 302 |
option may be used to specify the length of the generated with the |
| 303 |
.BR \-\-gen\-targkey |
| 304 |
option, and is only valid when specified with that option. |
| 305 |
.I LENGTH |
| 306 |
must be one of 128, 192, or 256. The default is 256. |
| 307 |
|
| 308 |
See below for a detailed description of |
| 309 |
.BR OPTIONS . |
| 310 |
The |
| 311 |
.BR \-\-help | \-h |
| 312 |
option will also show the arguments and options available. |
| 313 |
. |
| 314 |
.PP |
| 315 |
.SS "Exporting target keys" |
| 316 |
.B p11kmip |
| 317 |
.BR export\-key | export | exp |
| 318 |
.BR \-\-targkey\-label | \-t |
| 319 |
.I TARGKEY\-LABEL |
| 320 |
.BR \-\-wrapkey\-label | \-w |
| 321 |
.I WRAPKEY\-LABEL |
| 322 |
.RB [ \-\-retr\-wrapkey ] |
| 323 |
.RB [ \-\-wrapkey\-attrs |
| 324 |
.IR WRAPKEY\-ATTRS ] |
| 325 |
.RB [ \-\-wrapkey\-id |
| 326 |
.IR ID ] |
| 327 |
.RB [ OPTIONS ] |
| 328 |
.PP |
| 329 |
Use the |
| 330 |
.BR export\-key |
| 331 |
command to export a target key located in a PKCS\~#11 token |
| 332 |
repository to a KMIP server. Exporting a key from a PKCS\~#11 slot to a KMIP server requires an |
| 333 |
unwrapping key to be present on the server with a corresponding wrapping key present in the |
| 334 |
PKCS\~#11 slot. Currently only RSA is supported for wrapping and unwrapping keys and |
| 335 |
AES for target keys. |
| 336 |
|
| 337 |
The |
| 338 |
.BR \-\-targkey\-label | \-t |
| 339 |
.I TARGKEY\-LABEL |
| 340 |
option specifies the |
| 341 |
.B CKA_LABEL |
| 342 |
attribute value of the target key to be exported. |
| 343 |
Once exported to the KMIP server, the KMIP name attribute of the |
| 344 |
target key will be set to the same value as |
| 345 |
.IR TARGKEY\-LABEL . |
| 346 |
The |
| 347 |
.BR \-\-wrapkey\-label | \-w |
| 348 |
.I WRAPKEY\-LABEL |
| 349 |
option species the |
| 350 |
.B CKA_LABEL |
| 351 |
attribute value of key to be used for wrapping the exported key. The wrapping |
| 352 |
key must already be present in PKCS\~#11 token repository, unless the |
| 353 |
.BR \-\-retr\-wrapkey |
| 354 |
option is specified. |
| 355 |
|
| 356 |
The exported key will be unwrapped corresponding unwrapping key |
| 357 |
located on the KMIP server with a KMIP name attribute that is the same as |
| 358 |
.I WRAPKEY\-LABEL |
| 359 |
. |
| 360 |
|
| 361 |
When the |
| 362 |
.BR \-\-retr\-wrapkey |
| 363 |
option is specified, the |
| 364 |
.BR \-\-wrapkey\-label | \-w |
| 365 |
.I WRAPKEY\-LABEL |
| 366 |
option will instead be used to identify a wrapping key |
| 367 |
located on the KMIP server with a KMIP name attribute that is the |
| 368 |
same as |
| 369 |
.IR WRAPKEY\-LABEL . |
| 370 |
This wrapping key will be retrieved from the KMIP server and imported into the |
| 371 |
PKCS\~#11 token repository, with a |
| 372 |
.B CKA_LABEL |
| 373 |
attribute value of |
| 374 |
.I WRAPKEY\-LABEL |
| 375 |
, and used to wrap the exported key. When the wrapping key is being retrieved |
| 376 |
from the KMIP server, the |
| 377 |
.B \-\-wrapkey\-attrs |
| 378 |
.I WRAPKEY\-ATTRS |
| 379 |
option can be used to set the boolean attributes of the retrieved wrapping key |
| 380 |
(see below for detailed description of the attributes). The |
| 381 |
.B \-\-wrapkey\-id |
| 382 |
.I ID |
| 383 |
option may be used to set the value of the |
| 384 |
.BR CKA_ID |
| 385 |
attribute of the public key. |
| 386 |
|
| 387 |
After the export operation has been completed successfully, information will be displayed |
| 388 |
about the keys involved. This includes the |
| 389 |
.B CKA_LABEL |
| 390 |
attribute values of the exported target key and public key, the KMIP UID attributes |
| 391 |
of both keys, and a SHA-256 digest of the exported target key from both the KMIP server and the |
| 392 |
PKCS\~#11 token repository. |
| 393 |
|
| 394 |
Example: |
| 395 |
Target Key |
| 396 |
PKCS#11 Label...TARGET_KEY_LABEL |
| 397 |
PKCS#11 Digest..FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
| 398 |
KMIP UID........TARGET_KEY_UUID |
| 399 |
KMIP Digest.....AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 400 |
Wrapping Key |
| 401 |
PKCS#11 Label...WRAPPING_KEY_LABEL |
| 402 |
KMIP UID........WRAPPING_KEY_UUID |
| 403 |
|
| 404 |
See below for a detailed description of |
| 405 |
.BR OPTIONS . |
| 406 |
The |
| 407 |
.BR \-\-help | \-h |
| 408 |
option will also show the arguments and options available. |
| 409 |
. |
| 410 |
. |
| 411 |
.SH OPTIONS |
| 412 |
|
| 413 |
.TP 8 |
| 414 |
.BR \-\-wrapkey\-attrs \-a\~\fIWRAPKEY\-ATTRS\fP | \-\-targkey\-attrs \-a\~\fITARGKEY\-ATTRS\fP |
| 415 |
For the |
| 416 |
.B export\-key |
| 417 |
command, specify the PKCS\~#11 boolean attributes that are to be set for the |
| 418 |
retrieved wrapping key. For the |
| 419 |
.B import\-key |
| 420 |
, specify the PKCS\~#11 boolean attributes that are to be set for the |
| 421 |
imported target key. |
| 422 |
.PP |
| 423 |
.RS 8 |
| 424 |
.B Note: |
| 425 |
Not all boolean attributes are applicable to all key types and/or commands and |
| 426 |
will be silently ignored if not applicable. |
| 427 |
.PP |
| 428 |
The respective attributes are set to |
| 429 |
.B TRUE |
| 430 |
when the corresponding letter is specified in uppercase, or |
| 431 |
.B FALSE |
| 432 |
when the corresponding letter is specified in lowercase. |
| 433 |
Attributes (except \fBCKA_TOKEN\fP and \fBCKA_SENSITIVE\fP, see below) that are |
| 434 |
not specified get the default value as defined by the PKCS\~#11 standard or the |
| 435 |
used PKCS\~#11 token implementation when generating keys, or are not updated |
| 436 |
when setting the attributes of an existing key. |
| 437 |
.PP |
| 438 |
Attribute |
| 439 |
.B CKA_TOKEN |
| 440 |
is always set to \fBTRUE\fP for imported symmetric keys, and is set to \fBTRUE\fP |
| 441 |
by default for public keys. This is because session keys are not persistent, and |
| 442 |
thus would no longer exist after the session that the |
| 443 |
.B p11kmip |
| 444 |
tool has opened is closed when it exists. For public keys only, this can be overridden by |
| 445 |
specifying the respective uppercase or lowercase letter for the CKA_TOKEN attribute in |
| 446 |
the attribute string, as desired. |
| 447 |
.PP |
| 448 |
When importing or recieving a key with the |
| 449 |
.B p11kmip |
| 450 |
tool, attribute |
| 451 |
.B CKA_SENSITIVE |
| 452 |
defaults to \fBTRUE\fP for symmetric keys. However, this can be overridden by |
| 453 |
specifying the respective uppercase or lowercase letter for the CKA_SENSITIVE |
| 454 |
attribute in the attribute string, as desired. |
| 455 |
.PP |
| 456 |
.B Note: |
| 457 |
The default setting for the |
| 458 |
.B CKA_SENSITIVE |
| 459 |
attribute is defined by the |
| 460 |
.B p11kmip |
| 461 |
tool, and might be different from the default setting that would be chosen by |
| 462 |
the used PKCS\~#11 implementation. |
| 463 |
.PP |
| 464 |
The following letters are associated with the respective |
| 465 |
.BR CK_ATTRIBUTE : |
| 466 |
.IP "\(bu" 2 |
| 467 |
.B H |
| 468 |
\- CKA_TOKEN |
| 469 |
.IP "\(bu" 2 |
| 470 |
.B P |
| 471 |
\- CKA_PRIVATE |
| 472 |
.IP "\(bu" 2 |
| 473 |
.B M |
| 474 |
\- CKA_MODIFIABLE |
| 475 |
.IP "\(bu" 2 |
| 476 |
.B B |
| 477 |
\- CKA_COPYABLE |
| 478 |
.IP "\(bu" 2 |
| 479 |
.B Y |
| 480 |
\- CKA_DESTROYABLE |
| 481 |
.IP "\(bu" 2 |
| 482 |
.B S |
| 483 |
\- CKA_SENSITIVE |
| 484 |
.IP "\(bu" 2 |
| 485 |
.B X |
| 486 |
\- CKA_EXTRACTABLE |
| 487 |
.IP "\(bu" 2 |
| 488 |
.B K |
| 489 |
\- CKA_IBM_PROTKEY_EXTRACTABLE (IBM specific, not all tokens support this) |
| 490 |
.PP |
| 491 |
For multiple attributes, specify a set of these letters without any blanks in |
| 492 |
between, e. g. \fB'MlD'\fP. An uppercase letter means \fBTRUE\fP, while a |
| 493 |
lowercase letter means \fBFALSE\fP. |
| 494 |
From Example above, \fB'MbS'\fP corresponds to: \fBCKA_MODIFIABLE=TRUE, |
| 495 |
CKA_COPYABLE=FALSE, CKA_SENSITIVE=TRUE\fP. |
| 496 |
.PP |
| 497 |
.RE |
| 498 |
. |
| 499 |
. |
| 500 |
. |
| 501 |
.TP 8 |
| 502 |
.BR \-\-slot | \-s\~\fISLOT\fP |
| 503 |
Specifies the slot number of the PKCS\~#11 token to use. |
| 504 |
.PP |
| 505 |
.RS 8 |
| 506 |
Alternatively, the slot number may be specified using the |
| 507 |
.B PKCS11_SLOT_ID |
| 508 |
environment variable or the \fBp11kmip.conf\fP configuration |
| 509 |
file. See \fBp11kmip.conf\fP(5) for more details about using the configuration file. |
| 510 |
When one or more of these are set, the option takes highest priority, the |
| 511 |
environment variable second highest, and the configuration file least priority. |
| 512 |
When none are set, an error occurs. |
| 513 |
.RE |
| 514 |
. |
| 515 |
. |
| 516 |
. |
| 517 |
.TP 8 |
| 518 |
.BR \-\-pin | \-p\~\fIPIN\fP |
| 519 |
Specifies the PKCS\~#11 token user PIN to login with. |
| 520 |
.PP |
| 521 |
.RS 8 |
| 522 |
Alternatively, the |
| 523 |
.B PKCS11_USER_PIN |
| 524 |
environment variable may be used to provide the token user PIN. |
| 525 |
If neither this option is specified nor the environment variable is set, |
| 526 |
the user is prompted for the PIN. |
| 527 |
.RE |
| 528 |
.PP |
| 529 |
. |
| 530 |
. |
| 531 |
. |
| 532 |
.TP 8 |
| 533 |
.BR \-\-force\-pin\-prompt |
| 534 |
Force the |
| 535 |
.B p11kmip |
| 536 |
tool to prompt for the token user PIN (regardless of if it has been specified |
| 537 |
elsewhere) |
| 538 |
.PP |
| 539 |
. |
| 540 |
. |
| 541 |
. |
| 542 |
.TP 8 |
| 543 |
.BR \-\-kmip\-host\~\fIHOSTNAME\fP |
| 544 |
The hostname of the KMIP server with which to connect. |
| 545 |
.PP |
| 546 |
.RS 8 |
| 547 |
Alternatively, the hostname may be specified using the |
| 548 |
.B KMIP_HOSTNAME |
| 549 |
environment variable or the \fBp11kmip.conf\fP configuration |
| 550 |
file. See \fBp11kmip.conf\fP(5) for more details about using the configuration file. |
| 551 |
When one or more of these are set, the option takes highest priority, the |
| 552 |
environment variable second highest, and the configuration file least priority. |
| 553 |
When none are set, an error occurs. |
| 554 |
.RE |
| 555 |
. |
| 556 |
. |
| 557 |
. |
| 558 |
.TP 8 |
| 559 |
.BR \-\-kmip\-client\-cert\~\fICERT\-PATH\fP |
| 560 |
A path to the TLS client certificate to use for the KMIP connection. |
| 561 |
.PP |
| 562 |
.RS 8 |
| 563 |
Alternatively, the client certificate path may be specified using the |
| 564 |
.B KMIP_CLIENT_CERT |
| 565 |
environment variable, or the \fBp11kmip.conf\fP configuration |
| 566 |
file. See \fBp11kmip.conf\fP(5) for more details about using the configuration file. |
| 567 |
When one or more of these are set, the option takes highest priority, the |
| 568 |
environment variable second highest, and the configuration file least priority. |
| 569 |
When none are set, an error occurs. |
| 570 |
.RE |
| 571 |
. |
| 572 |
. |
| 573 |
. |
| 574 |
.TP 8 |
| 575 |
.BR \-\-kmip\-client\-key\~\fIKEY\-PATH\fP |
| 576 |
A path to the TLS client private key to use for the KMIP connection. |
| 577 |
.PP |
| 578 |
.RS 8 |
| 579 |
Alternatively, the client private key path may be specified using the |
| 580 |
.B KMIP_CLIENT_KEY |
| 581 |
environment variable or the \fBp11kmip.conf\fP configuration |
| 582 |
file. See \fBp11kmip.conf\fP(5) for more more details about using the configuration file. |
| 583 |
When one or more of these are set, the option takes highest priority, the |
| 584 |
environment variable second highest, and the configuration file least priority. |
| 585 |
When none are set, an error occurs. |
| 586 |
.RE |
| 587 |
. |
| 588 |
. |
| 589 |
. |
| 590 |
.TP 8 |
| 591 |
.BR \-\-pem\-password\~\fIPEM\-PASSWORD\fP |
| 592 |
The password to use for the TLS client key PEM file, if it is password-protected. |
| 593 |
.PP |
| 594 |
.RS 8 |
| 595 |
Alternatively, the PEM password may be specified using the |
| 596 |
.B KMIP_PEM_PASSWORD |
| 597 |
environment variable. When both are set, the option takes higher priority. When |
| 598 |
neither are set, the user is prompted for the password. |
| 599 |
.RE |
| 600 |
.PP |
| 601 |
. |
| 602 |
. |
| 603 |
. |
| 604 |
.TP 8 |
| 605 |
.BR \-\-force\-pem\-password\-prompt |
| 606 |
Force the |
| 607 |
.B p11kmip |
| 608 |
tool to prompt for the TLS client key PEM password (regardless of if it has been |
| 609 |
specified elsewhere). |
| 610 |
.PP |
| 611 |
. |
| 612 |
. |
| 613 |
. |
| 614 |
.TP 8 |
| 615 |
.BR \-\-tls\-verify\-hostname |
| 616 |
Enforce verification of the KMIP server hostname. |
| 617 |
.PP |
| 618 |
. |
| 619 |
. |
| 620 |
. |
| 621 |
.TP 8 |
| 622 |
.BR \-\-tls\-no\-verify\-certificate |
| 623 |
Skip verification of the KMIP server TLS certificate. |
| 624 |
.PP |
| 625 |
. |
| 626 |
. |
| 627 |
. |
| 628 |
.TP 8 |
| 629 |
.BR \-\-tls\-trust\-server\-cert |
| 630 |
Perform verification of the KMIP server TLS certificate, but do not prompt the |
| 631 |
user for trust of this server. |
| 632 |
.PP |
| 633 |
. |
| 634 |
. |
| 635 |
. |
| 636 |
.TP 8 |
| 637 |
.BR \-\-debug | \-d |
| 638 |
Increase debug information. |
| 639 |
.PP |
| 640 |
. |
| 641 |
. |
| 642 |
. |
| 643 |
.TP 8 |
| 644 |
.BR \-\-quiet | \-q |
| 645 |
Suppress messages. |
| 646 |
.PP |
| 647 |
. |
| 648 |
. |
| 649 |
. |
| 650 |
.TP 8 |
| 651 |
.BR \-\-short | \-r |
| 652 |
Print shortened results. |
| 653 |
|
| 654 |
Example: |
| 655 |
SECRET_KEY_LABEL:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
| 656 |
SECRET_KEY_UUID:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 657 |
.PP |
| 658 |
. |
| 659 |
. |
| 660 |
. |
| 661 |
.TP 8 |
| 662 |
.BR \-\-help | \-h |
| 663 |
Prints help for the usage of the |
| 664 |
.B p11kmip |
| 665 |
tool and/or the respective command and then exits. |
| 666 |
.RE |
| 667 |
.PP |
| 668 |
. |
| 669 |
. |
| 670 |
. |
| 671 |
.TP 8 |
| 672 |
.BR \-\-version | \-v |
| 673 |
Prints the version of the |
| 674 |
.B p11kmip |
| 675 |
tool and then exits. |
| 676 |
.RE |
| 677 |
.PP |
| 678 |
. |
| 679 |
. |
| 680 |
. |
| 681 |
.SH "FILES" |
| 682 |
. |
| 683 |
.SS "/etc/opencryptoki/p11kmip.conf" |
| 684 |
This configuration file can be used to specify persistent settings to be used |
| 685 |
by the |
| 686 |
.B p11kmip |
| 687 |
for connections to KMIP servers and interactions with PKCS\~#11 token |
| 688 |
repositories. A custom file path can be set with environment variable |
| 689 |
\fBP11KMIP_DEFAULT_CONF_FILE\fP. If the environment variable is not set, then |
| 690 |
the global \fB/etc/opencryptoki/p11kmip.conf\fP config file is read. |
| 691 |
If this file is unavailable, an error message is displayed. |
| 692 |
.PP |
| 693 |
. |
| 694 |
. |
| 695 |
. |
| 696 |
.SH "ENVIRONMENT VARIABLES" |
| 697 |
|
| 698 |
.SS "P11KMIP_DEFAULT_CONF_FILE" |
| 699 |
A custom path for the \fBp11kmip.conf\fP config file can be set |
| 700 |
with the environment variable \fBP11KMIP_DEFAULT_CONF_FILE\fP. |
| 701 |
If the environment variable is not set, then |
| 702 |
the global \fB/etc/opencryptoki/p11kmip.conf\fP config file is read. |
| 703 |
If this file is unavailable, an error message is displayed. |
| 704 |
.PP |
| 705 |
. |
| 706 |
.SS "PKCS11_USER_PIN" |
| 707 |
The PKCS\~#11 token user PIN can be specified via the environment variable |
| 708 |
\fBPKCS11_USER_PIN\fP. If this environment variable is not set, and the option |
| 709 |
.BR \-\-pin | \-p |
| 710 |
.I PIN |
| 711 |
is not specified, p11kmip will prompt for the token user PIN interactively. |
| 712 |
.PP |
| 713 |
. |
| 714 |
.SS "PKCS11_SLOT_ID" |
| 715 |
The PKCS\~#11 token slot number can be specified via the environment variable |
| 716 |
\fBPKCS11_SLOT_ID\fP. If this environment variable is not set, and the option |
| 717 |
.BR \-\-pin | \-p\~\fIPIN\fP |
| 718 |
is not specified, the value will be read from the \fBp11kmip.conf\fP |
| 719 |
configuration file. |
| 720 |
.PP |
| 721 |
. |
| 722 |
.SS "PKCSLIB" |
| 723 |
An alternative PKCS\~#11 library name can be specified with the \fBPKCSLIB\fP |
| 724 |
environment variable. If this environment variable is not set, then the default |
| 725 |
PKCS\~#11 library \fBlibopencryptoki.so\fP is used. |
| 726 |
.PP |
| 727 |
. |
| 728 |
.SS "KMIP_HOSTNAME" |
| 729 |
The hostname of the KMIP server with which to connect can be specified |
| 730 |
using the \fBKMIP_HOSTNAME\fP environment variable. If this environment variable |
| 731 |
is not set, and the option |
| 732 |
.BR \-\-kmip\-host\~\fHOSTNAME\fP |
| 733 |
is not specified, the value will be read from the \fBp11kmip.conf\fP |
| 734 |
configuration file. |
| 735 |
.PP |
| 736 |
. |
| 737 |
.SS "KMIP_CLIENT_CERT" |
| 738 |
The path to the TLS client certificate to use for the KMIP connection can be |
| 739 |
specified using the \fBKMIP_CLIENT_CERT\fP environment variable. |
| 740 |
If this environment variable is not set, and the option |
| 741 |
.BR \-\-kmip\-client\-cert\~\fCERT\-PATH\fP |
| 742 |
.PP |
| 743 |
. |
| 744 |
.SS "KMIP_CLIENT_KEY" |
| 745 |
The path to the TLS client key to use for the KMIP connection can be specified |
| 746 |
using the \fBKMIP_CLIENT_KEY\fP environment variable. |
| 747 |
If this environment variable is not set, and the option |
| 748 |
.BR \-\-kmip\-client\-key\~\fBKEY\-PATH\fP |
| 749 |
.PP |
| 750 |
. |
| 751 |
.SS "KMIP_PEM_PASSWORD" |
| 752 |
The PEM file used for the TLS client key may be password protected. The PEM |
| 753 |
password can be specified via the environment variable |
| 754 |
\fBKMIP_PEM_PASSWORD\fP. If this environment variable is not set, and the |
| 755 |
option |
| 756 |
.BR \-\-pem\-password\~\fPEM\-PASSWORD\fP |
| 757 |
is not specified, p11kmip will prompt for the PEM password interactively. |
| 758 |
. |
| 759 |
. |
| 760 |
. |
| 761 |
.SH "EXIT STATUS" |
| 762 |
The |
| 763 |
.B p11kmip |
| 764 |
tool returns error codes as defined by the PKCS\~#11 standard, i.e. the |
| 765 |
\fBCKR_nnn\fP errors. On success, \fBCKR_OK\fP (which is zero) is returned. |
| 766 |
.PP |
| 767 |
The PKCS\~#11 error codes may originate from a PKCS\~#11 function called by the |
| 768 |
.B p11kmip |
| 769 |
tool, or from the |
| 770 |
.B p11kmip |
| 771 |
tool itself, like the following: |
| 772 |
|
| 773 |
.SS CKR_ARGUMENTS_BAD (0x00000007): |
| 774 |
An argument, option or keyword is not valid. |
| 775 |
.PP |
| 776 |
. |
| 777 |
. |
| 778 |
. |
| 779 |
.SS CKR_DATA_INVALID (0x00000020): |
| 780 |
The \fBp11kmip.conf\fP cannot be parsed or its syntax is invalid. |
| 781 |
.PP |
| 782 |
. |
| 783 |
. |
| 784 |
. |
| 785 |
.SS CKR_MECHANISM_INVALID (0x00000070): |
| 786 |
The token does not support the key generation mechanism for the specified key |
| 787 |
type. |
| 788 |
.PP |
| 789 |
. |
| 790 |
. |
| 791 |
. |
| 792 |
.SS CKR_KEY_SIZE_RANGE (0x00000062): |
| 793 |
The token does not support the key size for the specified key type. |
| 794 |
.PP |
| 795 |
. |
| 796 |
. |
| 797 |
. |
| 798 |
.SS CKR_HOST_MEMORY (0x00000002): |
| 799 |
Allocating memory has failed. |
| 800 |
.PP |
| 801 |
. |
| 802 |
. |
| 803 |
. |
| 804 |
.SS CKR_FUNCTION_FAILED (0x00000006): |
| 805 |
A subfunction or library call has failed. |
| 806 |
.PP |
| 807 |
. |
| 808 |
. |
| 809 |
. |
| 810 |
.SH "SEE ALSO" |
| 811 |
.PD 0 |
| 812 |
.TP |
| 813 |
\fBp11kmip.conf\fP(5) |
| 814 |
.TP |
| 815 |
\fBp11sak\fP(1) |
| 816 |
.TP |
| 817 |
\fBopenssl\-genpkey\fP(1) |
| 818 |
.TP |
| 819 |
\fBopenssl\-req\fP(1) |
| 820 |
.PD |