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

Is it possible to run symmetric (aes or similar) block and stream cipher directly on the NK3? #497

Open
jerabaul29 opened this issue May 11, 2024 · 3 comments

Comments

@jerabaul29
Copy link

Is it possible to run AES or similar block and stream cipher directly on the NK3?

I.e., let us say I want to be able to perform symmetric encryption / decryption in a safe way. I would like to have the secret key checked onto the NK3 "checked in only, no way to extract it" like for the GPG private key, and then do the AES operations directly on the key (I guess this will, for speed reasons, only work for limited amounts of data, but fair enough).

Is this already supported / would this be doable / are there plans for making this possible? Not sure if there are standard APIs / methods, a la GPG-smartcard standard, to do this in a convenient way?

@sosthene-nitrokey
Copy link
Collaborator

Yes, this is possible through the GPG smartcard standard.

We respect the specification. See the PSO:DECIPHER and PSO:ENCIPHER commands. They will allow you to perform the encryption/decryption with AES 256 CBC on the NK3 with a key that cannot be extracted.

Be aware that the uses cases for this are limited since there is no authentication. Nonce reuse is also very dangerous.

@jerabaul29
Copy link
Author

Thanks! I was trying to google a bit about all of this, but this was actually quite difficult - do you know of a good resource which shows how to "check in" the AES key onto the smartcard / use the smartcard and a specific AES key to perform encryption / decryption?

@sosthene-nitrokey
Copy link
Collaborator

I am not aware of a simple resource just explaining how to communicate with the GPG application for this specific use case.

You probably want to start with learning about PC/SC and the library for that on your language of choice.

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

No branches or pull requests

2 participants