Skip to content

Implement PKCS#11 3.0 MessageSign API #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Jakuje
Copy link
Collaborator

@Jakuje Jakuje commented May 6, 2025

This is separated from #264 as it really does not depends on the 3.2 API.

Currently, this API is not implemented by any of the software tokens we have this tracked for kryoptic in latchset/kryoptic#74 but given that this really does not add new functionality, it is still quite a low priority.

For that reason, I do not have any test coverage there (but our understanding is that we should be able to use this API with existing mechanisms, just without passing any parameters to the sign_message_begin(), which would make it more handy to have the possibility to pass the param optional (or just define MessageParam::None. Thoughts?

Jakuje added 3 commits May 6, 2025 19:38
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Copy link
Member

@hug-dev hug-dev left a comment

Choose a reason for hiding this comment

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

For that reason, I do not have any test coverage there

Even SoftHSM does not implement those? I was thinking that maybe a simple single-part test would be enough.
Is it also possible to write a test but not run it on CI or mark it as failable?

@@ -1,6 +1,6 @@
// Copyright 2025 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
//! Encrypting data
//! Decrypting messages
Copy link
Member

Choose a reason for hiding this comment

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

🕵️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, did not write it right the first time :)

use cryptoki_sys::*;
use std::convert::TryInto;

impl Session {
Copy link
Member

Choose a reason for hiding this comment

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

Could we re-organize the methods here to split single-part and multi-part?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was starting from the sign/verify API, which was in a single file. The semantics is also interleaved as we need to initialize the operation first and then call either one-shot or multipart operations, which really does not make a good split as for both of the ways, we need the operation initialization.

@Jakuje
Copy link
Collaborator Author

Jakuje commented May 12, 2025

For that reason, I do not have any test coverage there

Even SoftHSM does not implement those?

No. This is PKCS#11 3.0 API, which is not present in SoftHSM.

I was thinking that maybe a simple single-part test would be enough. Is it also possible to write a test but not run it on CI or mark it as failable?

I hope we will get some implementation in kryoptic in foreseeable future, but we got stuck with the oasis-tcs/pkcs11#16 as it is not clear to neither of us what mechanisms should this API be usable with and in what semantics.

I will probably change it back to draft for now. To be able to write some tests, we will need some new parameters and some mechanisms to use with this API. Adding unusable API makes no sense.

@Jakuje Jakuje marked this pull request as draft May 12, 2025 16:14
@Jakuje
Copy link
Collaborator Author

Jakuje commented Jun 12, 2025

For the record (until I will forget), I discussed today with Bob why these functions are in the PKCS#11 specs and if there is some use case or mechanism that could use them and there really is not so it really does not make sense to implement them (too late!).

That said, I do not think this should be merged before we will have some use case. So keeping as a draft now, but I am also ok with closing it. I will just pull the fix in the decryption header to separate PR.

@Jakuje Jakuje mentioned this pull request Jun 12, 2025
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