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

Curve25519 generic keyparsing #8129

Merged
merged 5 commits into from
Oct 31, 2024

Conversation

bigbrett
Copy link
Contributor

@bigbrett bigbrett commented Oct 30, 2024

Adds API for curve25519 der import/export that can handle both private and public keys in one step. I realize that typically curve25519 keys are distributed as public/private only, since you can recover the public key from the private key, but this API simplifies usage for some cases in that it doesn't require multiple import attempts if you don't know at runtime what the contents of a der key holds.

This API is particularly useful for wolfHSM, where the server doesn't know what the contents of a DER key contain when it loads/stores from NVM, but needs to import the key into a curve25519_key struct that then will have the proper public/private key fields set. The current API doesn't provide a straightforward way to do this.

Added doxygen, and will update the manual/docs once this merges

Testing

  • Added test to ensure new API can handle private only/public only keys in the same exact way as the existing API
  • Added test to ensure a combined keypair import/export yields the same exported der as public/private only

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

dgarske
dgarske previously approved these changes Oct 30, 2024
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

Over to @SparkiDev

wolfcrypt/src/asn.c Show resolved Hide resolved
wolfcrypt/src/asn.c Show resolved Hide resolved
wolfcrypt/test/test.c Show resolved Hide resolved
doc/dox_comments/header_files/asn_public.h Show resolved Hide resolved
doc/dox_comments/header_files/asn_public.h Show resolved Hide resolved
@bigbrett
Copy link
Contributor Author

@dgarske @SparkiDev addressed all feedback

@bigbrett bigbrett requested review from SparkiDev and dgarske October 31, 2024 21:53
Copy link
Contributor

@SparkiDev SparkiDev left a comment

Choose a reason for hiding this comment

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

Great work by the way.

@SparkiDev SparkiDev merged commit 24003b2 into wolfSSL:master Oct 31, 2024
142 checks passed
@bigbrett
Copy link
Contributor Author

bigbrett commented Nov 1, 2024

Thanks @SparkiDev!

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.

4 participants