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

Import Raw RSA Private Key #7608

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Import Raw RSA Private Key #7608

merged 1 commit into from
Jun 3, 2024

Conversation

ejohnstown
Copy link
Contributor

Description

Add API wc_RsaPrivateKeyDecodeRaw() for importing an RSA private key when all you have are the components of the key in raw arrays. Also recalculates dP and dQ if missing.

Testing

Built wolfSSL with --enable-wolfssh --enable-lowresource. Tested against a pending build of wolfSSH that uses the new function if available. Tested with and without low resource set.

Checklist

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

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.

Nice work. This will sure be handy for wolfSSH

tests/api.c Show resolved Hide resolved
@ejohnstown ejohnstown force-pushed the rsa-add branch 3 times, most recently from 2cdbde4 to 639d5f7 Compare June 1, 2024 23:29
@ejohnstown ejohnstown requested a review from dgarske June 1, 2024 23:54
dgarske
dgarske previously approved these changes Jun 2, 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.

@SparkiDev please review also. Thank you


#if defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA) || !defined(RSA_LOW_MEM)
/*
* Calculate y = x^(-1) mod d.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment doesn't match the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed the function as well.

1. Add API for importing an RSA private key, `wc_RsaPrivateKeyDecodeRaw()`,
   when all you have are the components of the key in raw arrays. Also
   recalculates dP and dQ if missing.
2. Add API test for `wc_RsaPrivateKeyDecodeRaw()`.
@dgarske dgarske self-assigned this Jun 3, 2024
@dgarske dgarske merged commit 43f4ba9 into wolfSSL:master Jun 3, 2024
103 checks passed
@ejohnstown ejohnstown deleted the rsa-add branch June 3, 2024 17:08
jefferyq2 pushed a commit to jefferyq2/wolfssl that referenced this pull request Jun 9, 2024
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