Skip to content

Add integration test for PKCS#11 module#385

Merged
simo5 merged 2 commits intolatchset:mainfrom
simo5:interation_tests
Jan 19, 2026
Merged

Add integration test for PKCS#11 module#385
simo5 merged 2 commits intolatchset:mainfrom
simo5:interation_tests

Conversation

@simo5
Copy link
Copy Markdown
Member

@simo5 simo5 commented Dec 12, 2025

Description

Add an integration test to the cdylib crate using the rust-cryptoki library to act as a client to the PKCS#11 shared library.

This finally establishes end-to-end testing, of the actual pkcs#11 driver generated from the cdylib crate which is what is used by users.

The rust-cryptoki crate is used to drive the testing.

Checklist

  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Rustdoc string were added or updated
  • CHANGELOG and/or other documentation added or updated
  • This is not a code change

Reviewer's checklist:

  • Any issues marked for closing are fully addressed
  • There is a test suite reasonably covering new functionality or modifications
  • This feature/change has adequate documentation added
  • A changelog entry is added if the change is significant
  • Code conform to coding style that today cannot yet be enforced via the check style test
  • Commits have short titles and sensible text
  • Doc string are properly updated

@simo5 simo5 requested a review from Jakuje December 12, 2025 19:12
@simo5 simo5 force-pushed the interation_tests branch 4 times, most recently from 42f7eb9 to 1f8230e Compare December 15, 2025 18:19
@simo5 simo5 force-pushed the interation_tests branch 15 times, most recently from b59fa9f to 749fcdd Compare January 16, 2026 20:38
@simo5 simo5 requested review from Jakuje and removed request for Jakuje January 16, 2026 20:45
Copy link
Copy Markdown
Contributor

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aside of the inline comment, lgtm

Comment thread cdylib/token.sql Outdated
Add an integration test to the cdylib crate using the `rust-cryptoki` library
to act as a client to the PKCS#11 shared library.

This test verifies the core functionality by executing a standard workflow:
initializing the library, initializing a token, setting SO and User PINs,
logging in, and generating an RSA key pair. This ensures the C ABI for
fundamental operations is working as expected.

Signed-off-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Simo Sorce <simo@redhat.com>
@simo5
Copy link
Copy Markdown
Member Author

simo5 commented Jan 19, 2026

I fixed the issue with the committed database but also made integration tests optional.

To run them you have to explicitly run cargo build before you run cargo test in order to generate the .so, so on a clean project running just cargo test would fail.

With the integration tests made optional, cargo test will run all other tests fine on a clean tree. I think this is a better experience.

I tried to make the dependency on cryptoki optional too, but dev-dependencies can't be made optional so we'll have to keep it as it is.

@simo5 simo5 requested a review from Jakuje January 19, 2026 14:52
@simo5 simo5 merged commit 851e5b3 into latchset:main Jan 19, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants