-
Notifications
You must be signed in to change notification settings - Fork 17
Add PEM to DER conversion support in WolfCrypt class #186
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 PEM to DER conversion functionality to the WolfCrypt Java bindings by wrapping native wolfSSL APIs (wc_KeyPemToDer(), wc_CertPemToDer(), and wc_PubKeyPemToDer()) in the com.wolfssl.WolfCrypt class.
Key Changes
- Three new public static methods in WolfCrypt.java for PEM to DER conversions (private keys, certificates, public keys)
- JNI C implementation with proper memory management and error handling
- Comprehensive JUnit test suite with 22 test cases covering normal operations, edge cases, and threading scenarios
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/wolfssl/wolfcrypt/WolfCrypt.java | Adds three public static methods (keyPemToDer, certPemToDer, pubKeyPemToDer) with input validation and documentation |
| jni/jni_wolfcrypt.c | Implements JNI native functions with proper memory management, error handling, and conditional compilation |
| jni/include/com_wolfssl_wolfcrypt_WolfCrypt.h | Adds JNI function declarations for the three new native methods |
| src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTest.java | Comprehensive test suite with 585 lines covering functionality, error cases, and thread safety |
| src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTestSuite.java | Adds WolfCryptTest.class to the test suite |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5e9ba49 to
c2652f9
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 4 out of 4 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c2652f9 to
9cab842
Compare
4afe224 to
f51a9d9
Compare
f51a9d9 to
84f9c8e
Compare
This PR wraps native wolfSSL APIs
wc_KeyPemToDer(),wc_CertPemToDer(), andwc_PubKeyPemToDer()in thecom.wolfssl.WolfCryptclass:JUnit tests are added as part of this PR.