Comments (2)
AES/GCM/NoPadding
is the only symmetric encryption mode that JceMasterKey
supports. Let me explain.
We have a much more detailed write up of the AWS Encryption SDK approach here[1]. I'll summarize the high points briefly here, but if you're interested in the details I would highly recommend going through the more detailed docs.
The AWS Encryption SDK is an approach to envelope encryption: your actual plaintext is encrypted by a data key and that data key is protected by a master key. Using the cryptographic materials managers, master key providers, and master keys that we provide, the standard behavior is that every plaintext message has a unique data key (generated by a master key). That data key is then encrypted by each master key that you configure.
In other words: the only thing that the JceMasterKey
ever encrypts is data keys: 32 bytes per plaintext message.
Internally to the AWS Encryption SDK, we then use that data key to protect the plaintext. If you are using a KDF algorithm suite[2] (the default), we additionally use HKDF to derive a unique encryption key from the data key. Because of this, even if you do reuse data keys across messages[3], the actual key that we use to encrypt your plaintext is unique per message. This is why the provided data key caching resources do not allow data key reuse when using non-KDF algorithm suites. We do not recommend using the non-KDF algorithm suites: they are provided for legacy compatibility.
When we encrypt the message, we encrypt the plaintext in frames[4] and use a unique IV and GCM AAD for each frame.
You are correct that there are limits to the amount of data that can safely be encrypted using a single key with AES GCM. However, this limit is actually based on the combination of a unique key and IV pair. To protect against the key-IV pair ever being reused, we use deterministic IVs[5] when encrypting the frames. The same encryption key is used to encrypt all frames in a message, but using deterministic IVs guarantees that no two frames in a single message will have the same key-IV pair.
You can encrypt up to 2GiB per frame (frame size is configurable by the caller) and you can include up to ~4 billion (2^32 - 1) frames per message. This allows you to safely encrypt up to ~8EiB of data per message.
We recommend only using a single master key material for up to about a billion encryption operations. In the context of a master key, that translates to one encryption operation per message. If you are using JceMasterKey
, you will need to manage that master key and any rotation yourself. In most cases you would probably want to rotate your master key material more frequently than every billion operations in order to reduce the blast radius of any single master key material.
[1] https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/introduction.html
[2] https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/algorithms-reference.html
[3] https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/data-key-caching.html
[4] https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/message-format.html#body-framing
[5] https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/IV-reference.html
from aws-encryption-sdk-java.
Wow, thanks you @mattsb42-aws this is a great explanation. Closing this issue.
from aws-encryption-sdk-java.
Related Issues (20)
- AWSCredentialsProvider Not Found HOT 1
- AWSCredentialsProvider Not Found HOT 2
- CVE-2023-33201 - new Encryption SDK release? HOT 1
- AwsKmsMrkAwareMasterKeyProvider always attempts to resolve defaultRegion through DefaultAwsRegionProviderChain HOT 3
- Need to generate data key without plaintext HOT 3
- Maven Compile Warning for SuppressFBWarnings HOT 3
- Intermittent exception in thread "main" com.amazonaws.encryptionsdk.exception.CannotUnwrapDataKeyException: Unable to decrypt any data keys HOT 3
- Intermittently we get "com.amazonaws.encryptionsdk.exception.CannotUnwrapDataKeyException: Unable to decrypt any data keys" caused by "com.amazonaws.encryptionsdk.exception.NoSuchMasterKeyException: Key must be in supplied list of keyIds" HOT 1
- IllegalArgumentException getting a master key due to localization HOT 1
- Chore: Audit Dependencies HOT 1
- V2 KmsMasterKeyProvider - cannot set Synch client - need to set proxy HOT 1
- Thread Pinning With Virtual Threads HOT 1
- Need to encrypt and decrypt with separate AWS account. How to specify the AWS access key and secret key programatically HOT 1
- [Question] en/decryptData with CryptoMaterialsManager is deprecated, how to migrate to non-deprecated? HOT 10
- Why software.amazon.awssdk:dynamodb is not a dependency
- [Question] Migrating from 2.4.1 to 3.0.0 HOT 1
- Encryption Context for DecryptionMaterials on v3.0.0 HOT 4
- How to compile into arm architecture can be used. solibrary HOT 1
- JavaDocs: Document replacement methods for MKP methods HOT 1
- Getting BadCiphertextException: Invalid version HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-encryption-sdk-java.