Skip to content

Conversation

Jakuje
Copy link
Collaborator

@Jakuje Jakuje commented Aug 18, 2025

The PKCS#11 3.2 introduces a way to query the session for the validation flags of the last operation. This is done with the new API C_GetSessionValidationFlags which is being exposed now also to the users of this crate.

It also defines the new attribute specifying if the given object is matching the requirements for the validation.

Last but not least there is new validation object exposing information about the validation itself.

There is currenly almost no coverage for these, as this is implemented only by kryoptic (as far as I know) and not enabled in the default build we are using in CI.

Opening as draft as it depends on some fixes in kryoptic (latchset/kryoptic#315) as well its based on other code changes here (#304).

Copy link
Collaborator

@wiktor-k wiktor-k left a comment

Choose a reason for hiding this comment

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

Looks good. I left the same nits as in other PRs so... please bear with me 😅

// SoftHSM does not support this attribute at all
assert_eq!(attrs.len(), 0);
} else {
// Kryoptic supports the ObjectValidationFlag only if it is built as a FIPS provider
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤔 is it possible to built it this way for our CI? I think it'd be cool to have some real results here :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. But its slow as it builds also the whole OpenSSL :) I was trying this locally and there are some more limitations and corner cases, which do not work or work differently and which we would have to workaround. But with the validation API, it should be quite easy to distinguish the FIPS and non-FIPS kryoptic version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the FIPS build of kryoptic and adjusted the tests to work with it. The build is slow, but after OpenSSL build will be cached, it should be faster (but still slower than other tests).

@Jakuje Jakuje force-pushed the pkcs11-3.2-validation branch 3 times, most recently from c4eba0f to dce5711 Compare September 12, 2025 09:46
@Jakuje Jakuje force-pushed the pkcs11-3.2-validation branch 2 times, most recently from 0787d51 to 9080717 Compare September 19, 2025 14:00
@Jakuje Jakuje force-pushed the pkcs11-3.2-validation branch from 9080717 to a5db2de Compare September 19, 2025 14:10
@Jakuje Jakuje marked this pull request as ready for review September 19, 2025 14:21
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