-
Notifications
You must be signed in to change notification settings - Fork 49
JDK Crypto Provider + FFM #1594
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
Open
dnamaz
wants to merge
12
commits into
godaddy:main
Choose a base branch
from
dnamaz:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ated dependencies.
…wsKmsClientFactory
- Add FFM (Foreign Function & Memory) implementation for Java 22+ - Use multi-release JAR to support both FFM and JNA - Auto-detect Java version and select best implementation - FFM provides 1.2x-2.7x performance improvement for secure memory ops - Update TransientSecretFactory with setPreferJna() option - Bump secure-memory to 0.1.7 - Update app-encryption to use secure-memory 0.1.7 - Add FFM benchmark results to CryptoBenchmarks.md FFM files (Java 22+): - FfmAllocator, FfmProtectedMemoryAllocator - LinuxFfmProtectedMemoryAllocator, MacOSFfmProtectedMemoryAllocator - FfmProtectedMemorySecret, FfmSecretFactory - Exception classes for FFM operations
- Create native-app sample using GraalVM 25 native-image - Use JDK crypto provider only (no BouncyCastle) - Use FFM for secure memory (falls back to JNA in JVM mode) - Include native-image configuration (reachability-metadata, reflect-config) - Add build scripts and comprehensive README Features: - 62MB standalone native executable - ~16x faster startup (20ms vs 327ms) - ~11x faster encryption (112µs vs 1271µs) - ~4.4x faster decryption (86µs vs 381µs) Files: - App.java - Main application - NativeStaticKeyManagementService.java - KMS using TransientSecretFactory - pom.xml - Maven config with native-maven-plugin - META-INF/native-image/* - GraalVM configuration - scripts/*.sh - Build scripts - README.md - Documentation with benchmarks
The 62MB native binary should not be in the repository. Build artifacts are already ignored via .gitignore patterns.
secure-memory: - JUnit Jupiter: 5.13.4 → 6.0.1 - Logback Classic: 1.5.20 → 1.5.21 - maven-source-plugin: 3.3.1 → 3.4.0 app-encryption: - JUnit Jupiter: 5.13.4 → 6.0.1 JUnit 6.0.1 (released Oct 31, 2025): - Unified versioning across Platform, Jupiter, Vintage - Removed separate junit.platform.version property - Minimum Java 17 (already met) All tests pass: - secure-memory: 40 tests - app-encryption: 298 tests
These auto-generated files in target/generated-sources/ were accidentally modified in a previous commit. Restored to match upstream/main.
secure-memory: - Add FfmProtectedMemorySecretTest (9 tests) - Add FfmSecretFactoryTest (6 tests) - Update TransientSecretFactoryTest with FFM auto-detection tests - Add java22-ffm Maven profile for conditional compilation/testing - Tests skip gracefully on Java 17, run on Java 22+ app-encryption: - Fix BouncyCastle deprecation: use factory methods GCMBlockCipher.newInstance(AESEngine.newInstance()) - Fix RandomStringGenerator deprecation: .build() -> .get() - Remove unused import in SessionFactoryGenerator Test results: - Java 17: 356 tests (17 FFM skipped), 0 failures - Java 25: 356 tests (1 skipped), 0 failures
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To help us get this pull request reviewed and merged quickly, please be sure to include the following items:
PR Type
What kind of change does this PR introduce?
Backward Compatibility
Is this change backward compatible with the most recently released version? Does it introduce changes which might change the user experience in any way? Does it alter the API in any way?
Issue Linking
What's new?
This pull request introduces several improvements and updates to the Java app-encryption SDK, focusing on enhanced cryptographic performance, dependency upgrades, and improved documentation. The most significant change is the addition of a comprehensive crypto benchmark document comparing BouncyCastle and JDK crypto engines across Java versions, highlighting the dramatic performance benefits of using JDK crypto with newer Java releases. The release also upgrades several dependencies, adds JMH for benchmarking, and introduces support for selecting the crypto engine in
SessionFactory.Documentation and Benchmarking Enhancements:
CryptoBenchmarks.mddocumenting performance comparisons between BouncyCastle and JDK crypto engines, Java version impacts, secure memory improvements (FFM vs JNA), and actionable recommendations for users. The document includes raw benchmark data, analysis, migration guidance, and related file references.Dependency and Version Upgrades:
securememorylibrary is updated to 0.1.7, which brings FFM support for secure memory on Java 22+. The project version is incremented to 0.3.4. [1] [2]Core SDK Improvements:
SessionFactoryclass to support selection of the crypto engine via a newCryptoEngineTypeparameter, allowing users to choose between BouncyCastle and JDK crypto implementations. The default remains BouncyCastle for backward compatibility. [1] [2] [3]Build and Telemetry:
dynamodb-local-metadata.jsonfile enabling telemetry for local DynamoDB usage.