Repository navigation
Sign with CA keys held on a PKCS #11 HSM - #33
Merged
Merged
Conversation
Adds Sigyll.Pkcs11, a signing provider ("pkcs11") built on
Pkcs11Interop 5.3.0 (Apache-2.0) that loads the HSM vendor's PKCS #11
library, or SoftHSM in development and CI.
- Keys are generated on the token as sensitive and never extractable
(RSA, ECDSA P-256/384/521); signing happens on the token with RSA
PKCS #1 v1.5 or ECDSA, whose signatures are returned DER-encoded.
- A key is recorded as HSM-held (Fips1403) only when
Pkcs11:HardwareProtected is set, the token is not SoftHSM, and the
key's own attributes show it was generated on the token and can
never leave it; otherwise it is recorded as software-protected, so a
trust domain requiring HSM-held CA keys refuses it.
- Configured by Pkcs11:LibraryPath, TokenLabel, UserPin (from a secret
store, never appsettings) and HardwareProtected. Deleting a
certificate's key destroys it on the token.
- Issuance reads any "provider:key" reference for an issuing CA
instead of listing providers by name.
- Vault Transit now states its keys are software-protected rather than
relying on the default.
- On Linux, Pkcs11Interop's "libdl" is resolved to libdl.so.2, which is
all glibc 2.34+ installs without developer packages.
- CI installs SoftHSM and runs the token tests: keys made on the token
and never extractable, RSA and ECDSA signatures that verify, a token
root that issues a certificate whose chain validates and signs a
valid CRL, destroyed keys, and SoftHSM never counting as hardware.
Without SoftHSM the token tests skip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015WNuLiokmqeoddhdh8X3As
SoftHSM has no maintained Windows build, so tools/softhsm/run-token-tests.ps1 runs the token tests in the .NET SDK image the Sigyll Dockerfile pins, with SoftHSM from Ubuntu. The repository is mounted read-only and copied, so nothing is installed on the machine and no build output lands in the working tree. .gitattributes keeps shell scripts LF so they run in the container from a Windows checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015WNuLiokmqeoddhdh8X3As
…e as a file Its package declares the licence as LICENSE.txt rather than an SPDX expression, so the BOM records no licence. The file is the Apache License 2.0 (checked in 5.3.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015WNuLiokmqeoddhdh8X3As
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Sigyll.Pkcs11, a signing provider (pkcs11) for CA keys held on a PKCS #11 HSM, built on Pkcs11Interop 5.3.0 (Apache-2.0, released 2025-02-02). SoftHSM stands in for the HSM in development and CI.Provider
Fips1403) only whenPkcs11:HardwareProtectedis set, the token is not SoftHSM, and the key's attributes show it was generated on the token and can never leave it. Otherwise it is recorded as software-protected, so a trust domain that requires HSM-held CA keys refuses it.Pkcs11:LibraryPath,TokenLabel,UserPin(from a secret store, never appsettings) andHardwareProtected. Deleting a certificate's key destroys it on the token.libdlis resolved tolibdl.so.2, which is all glibc 2.34+ (Ubuntu 24.04, the .NET images) installs without developer packages.Elsewhere
provider:keyreference for an issuing CA instead of listing providers by name.pkcs11option.Tests
tools/softhsm/run-token-tests.ps1runs them from Windows in the pinned .NET SDK container.Not yet
pkcs11under the AppHost (a development image with SoftHSM, and where the dev token's PINs come from).🤖 Generated with Claude Code
https://claude.ai/code/session_015WNuLiokmqeoddhdh8X3As