1
0
mirror of https://github.com/opencryptoki/opencryptoki.git synced 2026-10-24 05:39:17 +03:00

145 Commits

Author SHA1 Message Date
Ingo Franzki
22d88c2ea3 PKCSICSF: Allow to specify the SO PIN and RACF password as option
For better scripting capabilities, the SO PIN and the RACF password can
optionally be supplied via options -R and -S. If not specified you are
prompted for them.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
7f5c86a549 PKCSICSF: Allow to specify the slot number to create with '-a <token>'
If -slot is specified then create the new ICSF token at the given slot number.
Otherwise the next free slot is used.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
0daecd52ed PKCSICSF: Store absolute paths in ICSF token config for SASL method
If relative file names are specified for the SASL key and certificates,
store the absolute path of them into the ICSF token config file.
This makes it location independent.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
58d45b6ff1 ICSF: Support public session with SASL authentication
Since SASL authentication does not require unlocking the token master key
to obtain an RACF password, public sessions (sessions opened without a
prior User or SO login) are supported for accessing and operating on public
objects when using SASL. In contrast, Simple authentication requires a User
or SO login before token operations can be performed because the RACF
password must be decrypted from disk using the token master key.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
0d7bf34bee PKCSICSF: Update man page to document the SASL authentication setup steps
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
063621047a PKCSICSF: Add support for changing the RACF password
Use 'pkcsicsf -p <token-name>' to change the RACF password of an existing
ICSF token.

The pkcsicsf tool updates the RACF file under the XProcLock, so the ICSF
token must read the RACF file under the XProcLock. This prevents concurrent
reads on a RACF file that is currently modified.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
bf40a5fe9f ICSF: Introduce a FIPS-compliant token data store format
Similar to the FIPS-compliant token data store format of the other tokens,
define a new token data store format for the ICSF token.

The new data format is used when the ICSF token has 'tokversion = 3.28'
in the slot definition in opencryptoki.conf. Existing ICSF tokens continue
to work unchanged. New ICSF tokens added via the pkcsicsf tool will always
have 'tokversion = 3.28' and thus use the new data format.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
9681c3e6c7 MAN: Fix man page variable substitution
Not all variables ('@...@' placeholders) in man pages were correctly
substituted by AC_CONFIG_FILES or the existing SED rules.

Introduce a common substitution rule for man pages and process all
man pages with it.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-08 10:52:16 +02:00
Ingo Franzki
a2b89d9f85 Editorial updates and fixes in the p11sak man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
ab54a6c29e Editorial updates and fixes in the pkcstok_migrate man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
62f7c18d10 Editorial updates and fixes in the pkcstok_admin man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
e02ffd49e9 Editorial updates and fixes in the pkcsstats man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
4c5f37ee6f Editorial updates and fixes in the pkcsicsf man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
1beeeb7b0c Editorial updates and fixes in the pkcshsm_mk_change man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
0f2ee12f0a Editorial updates and fixes in the pkcsep11_session man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
59ff51966c Editorial updates and fixes in the pkcsep11_migrate man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
80ca460806 Editorial updates and fixes in the pkcscca man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
e610db80a9 Editorial updates and fixes in the p11kmip man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
9afc131a49 Editorial updates and fixes in the p11kmip.conf man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
8e83dc87b4 Editorial updates and fixes in the p11sak_defined_attrs.conf man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
ee5058b216 Editorial updates and fixes in the strength.conf and policy.conf man pages
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
db3547c92b Editorial updates and fixes in the opencryptoki.conf man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
3c59b0e81e Editorial updates and fixes in the opencryptoki man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
c7f9ddb72e PKCSSLOTD: Editorial updates and fixes in the man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
126cd749c4 PKCSCONF: Editorial updates and fixes in the man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-25 14:45:29 +02:00
Ingo Franzki
922ea4bf9e PKCSICSF: Make adding all ICSF tokens usable
Using pkcsicsf with '-a all' adds all available ICSF tokens. Mention this in
the man page.

For each added token, pkcsicsf prompts for the SO pin to set. Mention the
token name for which the SO pin is prompted.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:28:02 +02:00
Ingo Franzki
2878387eaf ICSF: Remove global slot_data variable
Using the global slot_data variable might cause issues when multiple ICSF
token instances are used. This variable is an array indexed by slot number,
holding the pointer to the slot data in the shared memory segment of the
token.

There is no need for this global variable, just remember the pointer to
the slot data in the shared memory segment of the token in the token
private data.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:28:01 +02:00
Ingo Franzki
655139c885 ICSF/PKCSICSF: Fix SO PIN handling for token creation and initialization
Currently the ICSF token is added using 'pkcsicsf -a' and the default
SO pin (87654321) must be used with it. Only then a subsequent setting
of the SO pin via 'pkcsconf -P' works (where the old pin is also the
default SO pin).

The reason for this is that 'pkcsicsf -a' does not create a NVTOK.dat,
and thus, when the token comes up  the very first time, the NVTOK.dat
is created, but with the SO default pin. This happens for example
during 'pkcsconf -P', before the new PIN is set.

Update pkcsicsf tool to also create an initial NVTOK.dat file which
contains the hash of the user supplied SO pin. Thus, any SO pin can
be used with 'pkcsicsf -a', and this already sets the SO pin.
The initial NVTOK.dat is a too short version, and will be written in
its full length on the very first use of the token.

With this change no subsequent 'pkcsconf -P' is required (but possible),
the desired SO pin is already set and the token is already initialized.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:28:01 +02:00
Ingo Franzki
97ec424766 STATISTICS/PKCSSTATS: Do not overflow statistics counters, saturate at max
When statistic counters would overflow, keep them at the maximum possible
value. Wrapping to zero is the worst possible outcome for an auditing tool,
it silently under-reports activity.

If a counter saturated, then the pkcsstatd display indicates this with
"[saturated]" instead of the counter value.

While at it also make the reset operation to operate in an per counter
atomic way. Otherwise counter increments might get lost while a reset is
performed.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:27:43 +02:00
Ingo Franzki
02a5eed4da PKCSSLOTD: Restrict token name and config name to allowed characters
Restrict the token name (tokname) and config name (confname) that is
specified in opencryptoki.conf to only contain certain characters.
They must not be '.' or '..', and must not contain '/'.
If the confname specified an absolute path, no restriction is applied.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:27:41 +02:00
Karel Srot
efeae1f27f Fix typos and errors in README.md and p11sak man page
README.md:
  - Fix "Fox example" typo (should be "For example")
  - Swap CPPFLAGS/LDFLAGS values in configure example (-I for CPPFLAGS,
    -L for LDFLAGS)
  - Fix word order "which features is it" to "which features it is"
  - Add missing verb "set" in DISTCHECK_CONFIGURE_FLAGS note and add
    closing period
  - Restore indentation of "For more installation information" line

man/man1/p11sak.1.in:
  - Fix "a AES" and "a AES-XTS" to "an AES" and "an AES-XTS"
  - Capitalize proper nouns "edwards" and "montgomery" in curve descriptions
  - Fix "Coyping" typo to "Copying" in two section headings
  - Remove stray "command, and the" and fix "supress" to "suppress" in
    --force|-f option description
  - Fix missing space in "samealgorithm" (two occurrences)

Signed-off-by: Karel Srot <ksrot@redhat.com>
2026-08-05 16:52:00 +02:00
Ingo Franzki
27cb983a84 P11SAK: Add support for the new ECDH_*_AES_KEY_WRAP mechanisms
Add support for the new ECDH_*_AES_KEY_WRAP mechanisms to the p11sak
wrap-key and unwrap-key commands.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-22 13:07:43 +02:00
Ingo Franzki
fbeef5e8c3 P11SAK: Add support for PKCS#11 v3.2 ML-DSA and ML-KEM key types
Add support for PKCS#11 v3.2 ML-DSA and ML-KEM key types to p11sak.
P11sak can now generate, list, export, import, extract, etc such keys.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-13 14:39:43 +02:00
Ingo Franzki
065027cf71 P11SAK: Add support for new PKCS#11 v3.2 attributes
Add support for the encapsulate/decapsulate attributes in p11sak.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-13 14:39:43 +02:00
Ingo Franzki
68c60d4ed4 P11SAK: Support ECDH-AESKW key wrapping with Montgomery keys as well
Besides EC keys, this wrapping mechanism also supports Montgomery keys.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-02-04 14:31:15 +01:00
Ingo Franzki
227470e223 P11SAK: Add support for the Edwards and Montgomery key types
Add key types 'ec-edwards' and 'ec-montgomery' to the p11sak tool,
and allow to generate, import, and export keys of these types.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-01-27 08:14:16 +01:00
Ingo Franzki
150d5ec2d9 P11SAK: Add option to list-key command to show EP11 session IDs
With the '-e'/'--ep11-session-id' option the list-key command shows the
EP11 session IDs of the listed keys. If a key is not bound to an EP11
session, then '-' or '[none]' is displayed.

This only works for EP11 tokens.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-11-27 10:50:55 +01:00
Ingo Franzki
5e27911d0a P11SAK: Add support for IBM-ML-DSA and IBM-ML-KEM key types
Enhance the p11sak tool to support IBM ML-DSA and IBM ML-KEM keys.
It can generate IBM ML-DSA and IBM ML-KEM keys, can list them and their
attributes, can remove, alter, etc them, just like with the other key types
as well.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-31 14:15:14 +01:00
Ingo Franzki
fe7f4917e0 P11SAK: Add support for EC curve BLS12-381
Make BLS12-381 known to p11sak, so that it can generate EC keys of this curve.

Public EC key objects of the BLS12-381 curve needs to have CKA_DERIVE=TRUE to
be used with the aggregate mechanism. Thus, allow to specify the CKA_DERIVE
attribute also for the public part of an EC key.

Note: As per PKCS#11 standard, public keys don't have the CKA_DERIVE attribute,
but we allow it anyway to be able to support BLS12-384 aggregation operations.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-29 14:27:12 +01:00
Ingo Franzki
66cfe6e921 P11SAK: Fix man page
Fixes: a3eb2b1f6b
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-09-08 08:50:28 +02:00
Ingo Franzki
a3eb2b1f6b P11SAK: Support exporting private keys to password protected PEM files
When exporting private keys, option '--encrypted-pem' can now be specified.
This causes the PEM file to be encrypted using AES-CBC and an AES 256 bit key
that is derived from the password.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-28 09:55:53 +02:00
Ingo Franzki
f37a55bf1d P11SAK: Man page fixes
Correctly escape dashes.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-28 09:55:53 +02:00
Ingo Franzki
7e4be10b89 P11KMIP: Document the use of HSM-protected client key in man page
Describe how to generate password protected or HSM protected client keys
and certificates, and how to use them with p11kmip.

While at it, fix a few typos.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-28 09:54:31 +02:00
Ingo Franzki
d79492dda2 P11SAK: Update man page to describe wrap-key and unwrap-key
Describe the 'wrap-key' and 'unwrap-key' commands and its options and
arguments.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-25 13:55:21 +02:00
Ingo Franzki
adae134dea P11SAK: Editorial corrections in help test and man page
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-25 13:55:21 +02:00
Ingo Franzki
825324d1bf P11SAK: Add support for SHA-HMAC key types
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-06-27 10:23:41 +02:00
Ingo Franzki
d086a7bb1b P11SAK: Allow larger RSA key sizes
Allow RSA key sizes of up to 16384 for the p11sak tool.

A token might not support all these RSA key sizes, but will return an
error if an RSA key size is used that is not supported by the token.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-06-24 08:20:59 +02:00
John Craig
1d161f8f32 P11KMIP: Update man page and help text terminology
Signed-off-by: John Craig <john.craig@ibm.com>
2025-05-06 16:26:39 +02:00
Ingo Franzki
a24f1d5902 P11SAK/P11KMIP: Refactor code to extract commonly used functions
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-10 15:16:07 +01:00
John Craig
26bf7a1893 P11KMIP: Add p11kmip, a tool for import and exporting PKCS#11 keys to a KMIP server
This tool may be used to export AES secret keys from a PKCS#11 token repository to a KMIP
server by wrapping them under a shared RSA key pair. This tool may also import AES secret
keys from a KMIP server to a PKCS#11 token repository using the same method.

Signed-off-by: John Craig <john.craig@ibm.com>
2025-02-19 09:08:19 +01:00