Skip to content
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

Allow binary PIN values for PKCS11 providers #603

Closed
ionut-arm opened this issue May 4, 2022 · 4 comments · Fixed by #631
Closed

Allow binary PIN values for PKCS11 providers #603

ionut-arm opened this issue May 4, 2022 · 4 comments · Fixed by #631
Labels
enhancement New feature or request medium Effort label

Comments

@ionut-arm
Copy link
Member

As mentioned here and here, some PKCS11 tokens allow (or even require) PINs that do not conform to the spec, e.g., containing null bytes. The functionality has already been added (but not released, as of writing this) in the Cryptoki crate to allow such PINs, however this needs to be plumbed up into Parsec.

The authentication value config options for the TPM provider can stand as examples of how this could be implemented, namely by allowing the passed value to take the form hex:..., and to default to treating it as a string otherwise.

Any implementation should be accompanied by configuration tests.

@ionut-arm ionut-arm added enhancement New feature or request medium Effort label labels May 4, 2022
@wiktor-k
Copy link

wiktor-k commented May 5, 2022

The authentication value config options for the TPM provider can stand as examples of how this could be implemented, namely by allowing the passed value to take the form hex:..., and to default to treating it as a string otherwise.

IIRC TPM also has a str: prefix escape-hatch just in case your password literally starts with hex:... (you'd then input it as str:hex:...).

@mohamedasaker-arm
Copy link
Contributor

Hi all, I think the suggested approach is fine. However, there is an unlikely corner case when the pin of the token is, for example:
"str:hex:normal_string".
The pin is a normal string that has str:hex: as a prefix
The alternative is to have a flag which indicates the type of pin provided

What do you think? Is it okay to ignore this unlikely corner case or go with the other approach?
@ionut-arm @wiktor-k

@ionut-arm
Copy link
Member Author

However, there is an unlikely corner case when the pin of the token is, for example:
"str:hex:normal_string".
The pin is a normal string that has str:hex: as a prefix

I don't think there's a problem there, the value you'd put in would be str:str:hex:... - basically, everything after the first str: is considered as a string PIN. Am I getting this right?

@mohamedasaker-arm
Copy link
Contributor

Yea true, I mean it might get confusing a bit in this case. but indeed it's not a problem with the implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium Effort label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants