-
Notifications
You must be signed in to change notification settings - Fork 16
Add wolfJCE RSA KeyFactory Implementation #169
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds RSA KeyFactory support to the wolfJCE provider, enabling conversion and management of RSA keys across different formats. The implementation includes comprehensive test coverage and JNI bindings for exporting/importing CRT parameters.
- Adds complete RSA KeyFactory implementation with support for various KeySpec formats (X509, PKCS8, RSAPublicKeySpec, RSAPrivateCrtKeySpec, RSAPrivateKeySpec)
- Implements separate key classes for RSA public keys, CRT private keys, and non-CRT private keys
- Adds JNI native methods for exporting and importing RSA CRT key parameters
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| WolfCryptRSAKeyFactory.java | Main KeyFactory implementation for RSA key format conversions |
| WolfCryptRSAPublicKey.java | RSAPublicKey implementation with X.509 encoding support |
| WolfCryptRSAPrivateCrtKey.java | RSAPrivateCrtKey implementation with full CRT parameters |
| WolfCryptRSAPrivateKey.java | RSAPrivateKey implementation for non-CRT keys |
| WolfCryptRSAKeyFactoryTest.java | Comprehensive test suite with 15 test methods |
| jni_rsa.c | JNI bindings for wc_RsaExportCrtKey and wc_RsaImportCrtKey |
| Rsa.java | Java wrappers for new native export/import methods |
| WolfCryptProvider.java | Registers RSA KeyFactory service |
| WolfCryptCipher.java | Updates error message for clarity |
| README_JCE.md | Documents new RSA KeyFactory support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptRSAKeyFactoryTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/wolfssl/provider/jce/test/WolfCryptRSAKeyFactoryTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/wolfssl/provider/jce/test/WolfCryptRSAKeyFactoryTest.java
Show resolved
Hide resolved
64308a4 to
6c631c6
Compare
6c631c6 to
d8c00d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d8c00d6 to
bf90812
Compare
…nerated header files
…for RSA KeyFactory usage
bf90812 to
fca84fe
Compare
This PR adds our own implementation of RSA KeyFactory (
KeyFactory.getInstance('RSA')).Additions include:
WolfCryptRSAKeyFactory: Handles key generation from specs (RSAPrivateCrtKeySpec,RSAPrivateKeySpec,RSAPublicKeySpec,X509EncodedKeySpec,PKCS8EncodedKeySpec) and key translationWolfCryptRSAPrivateCrtKey: CRT-enabled RSA private keys (implementsRSAPrivateCrtKey)WolfCryptRSAPrivateKey: Non-CRT RSA private keys (implementsRSAPrivateKeyonly)WolfCryptRSAPublicKey: RSA public key implementationwc_RsaImportCrtKey()andwc_RsaExportCrtKey()for raw RSA parameter import/exportUnit tests included for testing and regression.