Skip to content

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented Jan 21, 2026

This PR adds Cipher RSA/ECB/OAEPWithSHA-256AndMGF1Padding support to wolfJCE.

  • Implements OAEP encrypt/decrypt via wc_RsaPublicEncrypt_ex()/wc_RsaPrivateDecrypt_ex()
  • Add FeatureDetect.RsaOaepEnabled() detection
  • Add JUnit tests for testing and regression

ZD 21062

Copy link

Copilot AI left a 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 support for RSA OAEP (Optimal Asymmetric Encryption Padding) encryption with SHA-256 hash and MGF1 padding to wolfJCE. The implementation enables the cipher algorithm RSA/ECB/OAEPWithSHA-256AndMGF1Padding with proper interoperability with standard JCE providers.

Changes:

  • Adds native JNI bindings for wc_RsaPublicEncrypt_ex() and wc_RsaPrivateDecrypt_ex() to support OAEP operations
  • Implements Java wrapper methods encryptOaep() and decryptOaep() in the Rsa class with proper validation
  • Adds comprehensive test suite with 18 test cases covering basic operations, edge cases, error handling, and interoperability

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherRSAOAEPTest.java New comprehensive test suite with 18 test cases for OAEP functionality including basic operations, error handling, and interoperability tests
src/test/java/com/wolfssl/provider/jce/test/WolfJCETestSuite.java Registers new OAEP test class in test suite
src/main/java/com/wolfssl/wolfcrypt/Rsa.java Adds encryptOaep/decryptOaep methods with parameter validation and synchronization
src/main/java/com/wolfssl/wolfcrypt/FeatureDetect.java Adds RsaOaepEnabled() method for runtime feature detection
src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java Registers OAEP cipher with conditional compilation check
src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java Implements OAEP padding type with proper encryption/decryption routing and error handling
jni/jni_rsa.c Implements JNI wrappers for wc_RsaPublicEncrypt_ex and wc_RsaPrivateDecrypt_ex with proper resource management
jni/jni_feature_detect.c Implements RsaOaepEnabled detection using WC_NO_RSA_OAEP macro
jni/include/com_wolfssl_wolfcrypt_Rsa.h Adds JNI function declarations for OAEP operations
jni/include/com_wolfssl_wolfcrypt_FeatureDetect.h Adds JNI function declaration for RsaOaepEnabled
README_JCE.md Documents new cipher algorithm and alias in supported algorithms list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant