SYNOPSIS

p11tool [-flags] [-flag [value]] [--option-name[[=| ]value]] [url]

Operands and options may be intermixed. They will be reordered.

DESCRIPTION

Program that allows operations on PKCS #11 smart cards and security modules.

To use PKCS #11 tokens with GnuTLS the p11-kit configuration files need to be setup. That is create a .module file in /etc/pkcs11/modules with the contents 'module: /path/to/pkcs11.so'. Alternatively the configuration file /etc/gnutls/pkcs11.conf has to exist and contain a number of lines of the form 'load=/usr/lib/opensc-pkcs11.so'.

You can provide the PIN to be used for the PKCS #11 operations with the environment variables GNUTLS_PIN and GNUTLS_SO_PIN.

OPTIONS

Enable debugging.

This option takes an integer number as its argument. The value of number is constrained to being:

in the range  0 through 9999

Specifies the debug level.

Output file.

List all available tokens.

Export the object specified by the URL.

Export the certificate specified by the URL and its chain of trust.

Exports the certificate specified by the URL and generates its chain of trust based on the stored certificates in the module.

List all available mechanisms in a token.

List information on an available object in a token.

List all available objects in a token.

List all available certificates in a token.

List all certificates that have an associated private key.

List all available private keys in a token.

Lists all the private keys in a token that match the specified URL.

This is an alias for the --list-all-privkeys option.

This is an alias for the --list-all-privkeys option.

List all available certificates marked as trusted.

Writes the loaded objects to a PKCS #11 token.

It can be used to write private keys, certificates or secret keys to a token.

Deletes the objects matching the PKCS #11 URL.

Generate random data.

This option takes an integer number as its argument.

Asks the token to generate a number of bytes of random bytes.

Generate an RSA private-public key pair.

Generates an RSA private-public key pair on the specified token.

Generate an RSA private-public key pair.

Generates an RSA private-public key pair on the specified token.

Generate an RSA private-public key pair.

Generates an RSA private-public key pair on the specified token.

Export the public key for a private key.

Exports the public key for the specified private key

Sets a label for the write operation.

Marks the generated key to be a wrapping key.

The no-mark-wrap form will disable the option.

Marks the generated key with the CKA_WRAP flag.

Marks the object to be written as trusted.

The no-mark-trusted form will disable the option.

Marks the object to be generated/copied with the CKA_TRUST flag.

Marks the object to be written as a CA.

The no-mark-ca form will disable the option.

Marks the object to be generated/copied with the CKA_CERTIFICATE_CATEGORY as CA.

Marks the object to be written as private.

The no-mark-private form will disable the option. This option is enabled by default.

Marks the object to be generated/copied with the CKA_PRIVATE flag. The written object will require a PIN to be used.

This is an alias for the --mark-trusted option.

This is an alias for the --mark-ca option.

This is an alias for the --mark-private option.

Force (user) login to token.

The no-login form will disable the option.

Force security officer login to token.

The no-so-login form will disable the option.

Forces login to the token as security officer (admin).

This is an alias for the --so-login option.

Print detailed URLs.

The no-detailed-url form will disable the option.

Provide a hex encoded secret key.

Private key file to use.

Public key file to use.

Certificate file to use.

Use PKCS #8 format for private keys.

Specify the number of bits for key generate.

This option takes an integer number as its argument.

Specify the curve used for EC key generation.

Specify the security level.

This is alternative to the bits option. Available options are [low, legacy, medium, high, ultra].

Use DER/RAW format for input.

The no-inder form will disable the option.

Use DER/RAW format for input certificates and private keys.

This is an alias for the --inder option.

Use DER format for output certificates, private keys, and DH parameters.

The no-outder form will disable the option.

The output will be in DER or RAW format.

This is an alias for the --outder option.

Initializes a PKCS #11 token.

Specify the PIN to use on token initialization.

Alternatively the GNUTLS_PIN environment variable may be used.

Specify the Security Officer's PIN to use on token initialization.

Alternatively the GNUTLS_SO_PIN environment variable may be used.

Specify the PKCS #11 provider library.

This will override the default options in /etc/gnutls/pkcs11.conf

Disable all interaction with the tool. All parameters need to be specified on command line..

Display usage information and exit.

Pass the extended usage information through a pager.

Output version of program and exit. The default mode is `v', a simple

version. The `c' mode will print copyright information and `n' will print the full copyright notice.

EXAMPLES

To view all tokens in your system use:

$ p11tool --list-tokens

To view all objects in a token use:

$ p11tool --login --list-all "pkcs11:TOKEN-URL"

To store a private key and a certificate in a token run:

$ p11tool --login --write "pkcs11:URL" --load-privkey key.pem            --label "Mykey"
$ p11tool --login --write "pkcs11:URL" --load-certificate cert.pem            --label "Mykey"

Note that some tokens require the same label to be used for the certificate and its corresponding private key.

To generate an RSA private key inside the token use:

$ p11tool --login --generate-rsa --bits 1024 --label "MyNewKey"            --outfile MyNewKey.pub "pkcs11:TOKEN-URL"

The bits parameter in the above example is explicitly set because some tokens only support limited choices in the bit length. The output file is the corresponding public key. This key can be used to general a certificate request with certtool.

certtool --generate-request --load-privkey "pkcs11:KEY-URL"     --load-pubkey MyNewKey.pub --outfile request.pem

EXIT STATUS

One of the following exit values will be returned:

Successful program execution.

The operation failed or the command syntax was not valid.

libopts had an internal operational error. Please report

it to [email protected]. Thank you.

RELATED TO p11tool…

    certtool (1)

AUTHORS

Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls/AUTHORS for a complete list.

COPYRIGHT

Copyright (C) 2000-2014 Free Software Foundation, and others all rights reserved. This program is released under the terms of the GNU General Public License, version 3 or later.

BUGS

Please send bug reports to: [email protected]

NOTES

This manual page was AutoGen-erated from the p11tool option definitions.