P11-KIT(8)
๐
p11-kit โ the p11-kit(8) manual, bestie edition
okay so picture this: you're deep in System Commands territory and you've got a p11-kit situation. don't panic, i got you. this is the whole page, every flag, every path, no crumbs left behind. ๐ซถ
โจ NAME โจ
p11-kit โ the tool for doing stuff to your configured PKCS#11 modules. that's the whole vibe. ๐
๐ SYNOPSIS ๐
p11-kit list-modules
p11-kit list-tokens ...
p11-kit list-objects ...
p11-kit import-object ...
p11-kit export-object ...
p11-kit delete-object ...
p11-kit generate-keypair ...
p11-kit list-profiles ...
p11-kit add-profile ...
p11-kit delete-profile ...
p11-kit list-mechanisms ...
p11-kit print-config
p11-kit extract ...
p11-kit server ...
like. that's a lot of subcommands. main character energy fr fr. ๐
๐ฆ DESCRIPTION ๐ฆ
p11-kit is a command line tool, and what it does is perform operations on the PKCS#11 modules that are configured on your system. that's it. that's the whole job. โจ
go look at all the sub commands down below โ but first, real quick, here are the global options that work anywhere:
-v,--verboseโ run in verbose mode, with debug output. it will NOT stop talking and honestly? sometimes you need that. ๐ฃ๏ธ-q,--quietโ run in quiet mode, without warning or failure messages. silence. peace. no notes. ๐คซ
๐ธ LIST MODULES ๐ธ
lists the PKCS#11 modules that are configured on your system.
$ p11-kit list-modules
it'll show you the modules, info about them, and the tokens that are chillin' inside those PKCS#11 modules. full tour. ๐
๐ LIST TOKENS ๐
lists all the tokens available in the PKCS#11 modules that are configured on your system.
$ p11-kit list-tokens pkcs11:token
it grabs every token and shows off some of their common attributes. like a little token meet-and-greet.
this subcommand takes the following options:
--only-urisโ print only the matching token URIs. nothing else, just the URIs, that's the rule. โจ--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating all the modules installed on the system. and lowkey important: ifmodule_pathis a relative path, the module gets loaded from the default module path. you can find out what that path is by running:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ LIST OBJECTS ๐
lists the objects that match a given PKCS#11 URI.
$ p11-kit list-objects pkcs11:object_on_token
it retrieves every object matching that PKCS#11 URI and shows some of their common attributes. and here's a cute detail: storage objects also get their PKCS#11 URI displayed. slay.
this subcommand takes the following options:
--loginโ authenticate to the token before enumerating objects. the PIN value gets read from either thepin-valueattribute in the URI, or from the terminal. pick your fighter. ๐--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating all the modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. find that path with:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ IMPORT OBJECT ๐
imports an object into a PKCS#11 token.
$ p11-kit import-object --file=file.pem [--label=label] [--id=object_id] pkcs11:token
so what it does: it takes either an X.509 certificate or a public key (in the form of a PEM file) and imports it into the first token matched by the given PKCS#11 URI. first match wins, no cap.
the following options are required:
--file=<file.pem>โ the file containing either an X.509 certificate or a public key, in PEM format. yeah you gotta have this one, it's not optional bestie.
this subcommand also accepts the following options:
--label=<label>โ assignslabelto the imported object. ๐ท๏ธ--id=<object_id>โ assigns ID to the imported object. the ID should be specified in hexadecimal format without the0xprefix. no0x, we're serious.--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path, which you can determine by running:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ง EXPORT OBJECT ๐ง
exports the object matching a PKCS#11 URI.
$ p11-kit export-object pkcs11:object_on_token
it displays the PEM formatted contents of the first object matched by the given PKCS#11 URI. and important caveat, so listen up: the matched object has to either be an X.509 certificate or a public key. anything else and it's not happening. ๐
this subcommand takes the following options:
--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. you can determine that path by running:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ DELETE OBJECT ๐
deletes the object matching a PKCS#11 URI.
$ p11-kit delete-object pkcs11:object_on_token
bestie. this one destroys the first object matched by the given PKCS#11 URI. gone. poof. no undo button. ๐
this subcommand takes the following options:
--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. figure out that path with:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ GENERATE KEY-PAIR ๐
generates a key-pair on a PKCS#11 token. ๐โจ
$ p11-kit generate-keypair --type=algorithm {--bits=n|--curve=name} [--label=label] [--id=object_id] pkcs11:token
it generates a private-public key-pair of the given type on the first token matched by the given PKCS#11 URI. and here's the tea: you should use this command together with the --type option and one of --bits or --curve. one. not both. we'll get there.
the following options are required:
--type=<algorithm>โ specify the type of keys to generate. supported values arersa,ecdsaandeddsa. pick one bestie. ๐--bits=<n>โ specify the number of bits for the key-pair generation. cannot be used together with the--curveoption. ๐ซ--curve=<name>โ specify an elliptic curve for the key-pair generation. supported values aresecp256r1,secp384r1,secp521r1,ed25519anded448. cannot be used together with the--bitsoption. ๐ซ
this subcommand also accepts the following options:
--label=<label>โ assignslabelto the generated key-pair objects. ๐ท๏ธ--id=<object_id>โ assigns ID to the generated key-pair objects. the ID should be specified in hexadecimal format without the0xprefix. (again. NO0x.)--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. determine that path by running:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ LIST PROFILES ๐
lists the PKCS#11 profiles supported by the token.
$ p11-kit list-profiles pkcs11:token
it displays the profile IDs of the first token matched by the given PKCS#11 URI, in human-readable form. so you can actually read them. iconic.
this subcommand takes the following options:
--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. get that path with:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
โญ ADD PROFILE โญ
adds a PKCS#11 profile to a token.
$ p11-kit add-profile --profile=profile pkcs11:token
it creates a new profile object with the given profile ID on the first token matched by the given PKCS#11 URI. and heads up: this command fails if the profile ID already exists on the token. no duplicates allowed, periodt. ๐
the following options are required:
--profile=<profile>โ the profile ID to add. the value can either be numerical or textual. your call.
this subcommand also accepts the following options:
--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. you can determine this path by running:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ DELETE PROFILE ๐
deletes a PKCS#11 profile from a token.
$ p11-kit delete-profile --profile=profile pkcs11:token
it destroys all profile objects with the given profile ID from the first token matched by the given PKCS#11 URI. all of them. not one. all. ๐ญ
the following options are required:
--profile=<profile>โ the profile ID to delete. the value can either be numerical or textual.
this subcommand also accepts the following options:
--loginโ authenticate to the token before enumerating objects. the PIN value is read from either thepin-valueattribute in the URI or from the terminal.--provider=<module_path>โ load only the given PKCS#11 module instead of enumerating modules installed on the system. ifmodule_pathis a relative path, the module is loaded from the default module path. figure it out with:
$ pkg-config p11-kit-1 --variable p11_module_path
/usr/lib64/pkcs11
๐ฅ LIST MECHANISMS ๐ฅ
lists the PKCS#11 mechanisms supported by the token.
$ p11-kit list-mechanisms pkcs11:token
this lists all available mechanimsms for a PKCS#11 token. (yes, "mechanimsms". the original said it like that and honestly? i respect it. it's giving typo chic. ๐ we keep it exactly as-is because the facts don't change around here.)
๐ PRINT CONFIG ๐
prints the merged configuration.
$ p11-kit print-config
okay so here's the lore: p11-kit provides 3 levels of configuration โ system wide, per-module, and per-user. and at run-time, all 3 levels get merged into a single configuration. this command displays that merged configuration. so it's like the group chat where everyone's messages get combined into one chaotic beautiful thread. ๐ซถ
๐ฆ EXTRACT ๐ฆ
extracts certificates from configured PKCS#11 modules.
๐จ okay so this operation has been moved to a separate command:trust extract. seetrust(1)for more information. so if you came here looking for extract, go follow the breadcrumbs bestie. โจ
โจ SERVER โจ
Okay bestie, this one is giving main character energy โ it literally runs a whole server process that exposes a PKCS#11 module remotely. ๐
$ p11-kit server pkcs11:token1 pkcs11:token2 ...
$ p11-kit server --provider /path/to/pkcs11-module.so pkcs11:token1 pkcs11:token2 ...
So what it does: it launches a server that exposes the PKCS#11 tokens you named on a local socket. ๐ซถ
Heads up: the tokens must belong to the same module. Like, non-negotiable, they're a package deal. ๐ญ
To actually access that socket, you use the p11-kit-client.so module. That's the whole vibe.
And here's the cute part โ the server address and PID get printed out as a shell-script snippet that sets the appropriate environment variable, specifically:
P11_KIT_SERVER_ADDRESSP11_KIT_SERVER_PID
So you can just source it and go, no cap. โจ
๐ฆ EXTRACT TRUST ๐ฆ
Extract standard trust information files. ๐
Plot twist: this operation has been moved to a separate command,trust extract-compat. Seetrust(1)for more info. It's not living here anymore, it moved out and got its own place. ๐
๐ REMOTE ๐
Run a PKCS#11 module remotely. Remote queen behavior, honestly.
$ p11-kit remote /path/to/pkcs11-module.so
$ p11-kit remote pkcs11:token1 pkcs11:token2 ...
Okay so real talk โ this is not meant to be run directly from a terminal. It's meant to go in a remote option in a pkcs11.conf(5) file. That's its natural habitat. ๐ง
What it does: it exposes the given PKCS#11 module or tokens over standard input and standard output.
Those two forms โ exposing a module, or exposing tokens โ are mutually exclusive. Pick one, bestie, you can't have both. ๐ And if you go with the second form, the tokens must belong to the same module. Same rule as always, iconic consistency. ๐
๐ BUGS ๐
Found a bug? Please send bug reports to either the distribution bug tracker or the upstream bug tracker at:
https://github.com/p11-glue/p11-kit/issues/
They wanna hear from you, fr fr. ๐
๐ SEE ALSO ๐
Further details available in the p11-kit online documentation at:
https://p11-glue.github.io/p11-glue/p11-kit/manual/
And that's a wrap on the whole page, babe! ๐ This one's from p11-kit itself, living in section P11-KIT(8) โ go forth and configure your PKCS#11 stuff with confidence. You ate this. ๐
โจ๐ซถ
๐ฆ where this page comes from
- arch rolling: p11-kit 0.26.5-1 ยท BSD-3-Clause
- fedora 43: p11-kit 0.26.5-1.fc43 ยท BSD-3-Clause
- fedora 43: p11-kit 0.26.5-1.fc43 ยท BSD-3-Clause
- fedora 44: p11-kit 0.26.5-1.fc44 ยท BSD-3-Clause
- fedora 44: p11-kit 0.26.5-1.fc44 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms