Comments (2)
Hi @nlelch. Not intended; message encoding should be identical. It sounds like it may be a specific issue with the Java SDK as I'm struggling to replicate it in Go, PHP or raw HTTP.
From a purely HTTP perspective in Local KMS, I can create a data key:
http --json POST http://localhost:8080/ X-Amz-Target:TrentService.GenerateDataKey KeyId=205127e7-887a-4b07-ac92-6df4addbf58f KeySpec=AES_128
HTTP/1.1 200 OK
Content-Length: 314
Content-Type: application/x-amz-json-1.1
Date: Tue, 02 Jul 2019 07:36:03 GMT
{
"CiphertextBlob": "S2Fybjphd3M6a21zOmV1LXdlc3QtMjoxMTExMjIyMjMzMzM6a2V5LzIwNTEyN2U3LTg4N2EtNGIwNy1hYzkyLTZkZjRhZGRiZjU4ZgAAAADObau944y8nAMh0lSNm8H+w5fOUIxSXHfEioTTW7t02eZ8DUk4hFoAHRzT5Q==",
"KeyId": "arn:aws:kms:eu-west-2:111122223333:key/205127e7-887a-4b07-ac92-6df4addbf58f",
"Plaintext": "Kw1lrHDovDj/RDKZ4gHfRQ=="
}
Which returns a CiphertextBlob and Plaintext, both base64 encoded.
If I then pass that CiphertextBlob back to Decrypt
:
http --json POST http://localhost:8080/ X-Amz-Target:TrentService.Decrypt CiphertextBlob="S2Fybjphd3M6a21zOmV1LXdlc3QtMjoxMTExMjIyMjMzMzM6a2V5LzIwNTEyN2U3LTg4N2EtNGIwNy1hYzkyLTZkZjRhZGRiZjU4ZgAAAADObau944y8nAMh0lSNm8H+w5fOUIxSXHfEioTTW7t02eZ8DUk4hFoAHRzT5Q=="
HTTP/1.1 200 OK
Content-Length: 126
Content-Type: application/x-amz-json-1.1
Date: Tue, 02 Jul 2019 07:36:50 GMT
{
"KeyId": "arn:aws:kms:eu-west-2:111122223333:key/205127e7-887a-4b07-ac92-6df4addbf58f",
"Plaintext": "Kw1lrHDovDj/RDKZ4gHfRQ=="
}
I get the exact same Plaintext base64 value back as when I generated the Data Key.
Therefore it sounds like something else it trigging that Plaintext response to be base64 decoded at the Java level.
Are you able to supply me with any Java code snippets that I'm able to run against both KMSs that'll allow me to replicate the issue?
from local-kms.
I was using:
ByteBuffer ciphertextBlob = Place your ciphertext here;
DecryptRequest req = new DecryptRequest().withCiphertextBlob(ciphertextBlob);
ByteBuffer plainText = kmsClient.decrypt(req).getPlaintext();
However, I missed a step in my test encryption that was throwing off the encoding and now it works as expected. Thank you for your help!
from local-kms.
Related Issues (20)
- support for PutKeyPolicy? HOT 4
- Concurrency issues (resource temporarily unavailable) HOT 3
- Asymmetric key support ? HOT 3
- Proposal: Upgrade to Go Modules HOT 2
- Proposal: `go fmt` this codebase HOT 4
- Implement seeding of Asymmetric Keys HOT 4
- Unable to do encrypt/decrypt roundtrip with key aliases HOT 3
- Please update to Go 1.17 HOT 2
- Feautre: Support grants
- Return KeySpec instead of CustomerMasterKeySpec HOT 1
- importing secp256k1
- Publish `arm64` docker images HOT 2
- can you allow this to support ssl? HOT 2
- Key Alias+ARN 'Not Found' for Sign HOT 4
- [Question] Is it possible to use seed.yaml with KeyMaterial? HOT 1
- Update go version HOT 2
- Replace ioutil with os
- Different types of encrypted files
- [Vulnerability] btcsuite/btcd 0.22.0-beta
- [question] HTTPS support HOT 1
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 local-kms.