Repository navigation
PKCS #11 relay: reach SoftHSM over TCP for development and tests - #53
Merged
Merged
Conversation
Sigyll loads an HSM vendor's PKCS #11 library into its own process, and with a network HSM that library hides the connection. SoftHSM has no maintained Windows build, so a Sigyll running on Windows had no token to load at all. tools/pkcs11-relay recreates the network arrangement for development and tests: a client library, built from C# with Native AOT and loaded like any PKCS #11 library, forwards each call over TCP to a server that passes it to SoftHSM in a container. It forwards the 23 functions Sigyll and its tests use; the rest answer CKR_FUNCTION_NOT_SUPPORTED. A lost connection is reported as CKR_DEVICE_REMOVED. The existing PKCS #11 tests pass through it unchanged, on Windows (run-token-tests.ps1) and on Linux. CI runs them through the relay on Ubuntu and builds the Windows DLL. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015WNuLiokmqeoddhdh8X3As
Co-Authored-By: Claude Fable 5.2 <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.
What
tools/pkcs11-relay: a stand-in for a network HSM.sigyll-pkcs11-relay.dll/.so). It is loaded like a vendor's library and forwards each call over TCP.Dockerfileputs SoftHSM behind it.It forwards the 23 functions Sigyll and its tests use. A lost connection is reported as
CKR_DEVICE_REMOVED.Why
SoftHSM has no maintained Windows build, so Sigyll running on Windows had no PKCS #11 token to load. With the relay it uses SoftHSM in a container, through the Windows form of PKCS #11 (4-byte
CK_ULONG, packed structures) that a vendor's Windows library uses.Tested
./tools/pkcs11-relay/run-token-tests.ps1— 18 of 18 PKCS Bump the microsoft group with 18 updates #11 tests pass through the DLL, tests and provider unchanged..so.CI
Notes
Sigyll.slnx; nothing here ships with Sigyll.🤖 Generated with Claude Code
https://claude.ai/code/session_015WNuLiokmqeoddhdh8X3As