ex-aws / ex_aws_kms Goto Github PK
View Code? Open in Web Editor NEWExAws.KMS service package
Home Page: https://hex.pm/packages/ex_aws_kms
License: MIT License
ExAws.KMS service package
Home Page: https://hex.pm/packages/ex_aws_kms
License: MIT License
Hey @hirocaster, per https://elixirforum.com/t/proposal-exaws-2-0/9269 the ExAws project is splitting out each service into its own project.
You are the original contributor the KMS service to ExAws. If you wish to be its maintainer, please let me know and I will give you commit access to this repository. If you do not want this, let me know and I will look for someone else.
Thank you!
I think you should publish version 2.1.0 for hex.pm
ref #5
But, I don't have permission for hex.pm.
If you don't mind, can you release it? @benwilson512
memo: Don't forget to change README.md
def deps do
[
{:ex_aws, "~> 2.1"},
{:ex_aws_kms, "~> 2.1"},
{:poison, "~> 3.0"},
{:hackney, "~> 1.9"},
]
end
mix deps |grep ex_aws
: 2.2.2 (ex_aws_kms version 2.2.0)mix deps | grep hackney
: 1.17.4encrypt() doesn't currently work as you'd expect it to. KMS encrypt requires the plaintext value to be base64 encoded. Currently the library doesn't do this so you end up with a bad value.
I have verified that the problem is in the encrypt by using the aws cli to decrypt the ciphertext.
Here's an example.
`ExAws.KMS.encrypt("key-id", "foobar") |> ExAws.request
returns the Ciphertext value of "AQICAHhP4M1Q/HWR0J90p6ShL/0jKkUUrexGH4YlNL6o4thjYAG7Gjzq7UMO5L+BemSIJsVFAAAAYjBgBgkqhkiG9w0BBwagUzBRAgEAMEwGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMx+BQnTksyPLvqTxaAgEQgB8IpvmwFBSNa/wYY3lDxpjO1w7HbQ8vLOflmx2EI5d3"
and when you decrypt this using
ExAws.KMS.decrypt("AQICAHhP4M1Q/HWR0J90p6ShL/0jKkUUrexGH4YlNL6o4thjYAG7Gjzq7UMO5L+BemSIJsVFAAAAYjBgBgkqhkiG9w0BBwagUzBRAgEAMEwGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMx+BQnTksyPLvqTxaAgEQgB8IpvmwFBSNa/wYY3lDxpjO1w7HbQ8vLOflmx2EI5d3") |> ExAws.request!
You get back a plaintext value: foobag=='`
When you encrypt "foobar", decrypt on the resulting ciphertext should return "foobar".
As I see it, possibly the most idiomatic way may be to switch the parameter order in encrypt to have the ciphertext first then the key then opts so you can use it in a pipe Base.encode64("value") |> ExAws.KMS.encrypt("key-id", opts) |> ExAWS.request!
Of course, you could always do Of course, you could always do b64_value = Base.encode64("foobar")
then ExAws.KMS.encrypt(b64_value, "key-id")
but that's not very idiomatic as it prevents you from piping a base64 value into encrypt.
I will submit a PR for your consideration that reverses the parameter order in encrypt()
Please let me know if I'm way off base with this and what a better way would be? I'm still learning elixir.
Hello, thanks for this library.
I'm trying to update ex_aws to version 2.1.0 but ex_aws_kms requires ex_aws v2.0
config in mix.exs
Line 37 in 8257745
Elixir 1.7.4 (compiled with Erlang/OTP 21)
mix deps |grep ex_aws
ex_aws (Hex package) (mix)
locked at 2.0.2 (ex_aws) 8df2f96f
mix deps | grep hackney
hackney 1.14.3 (Hex package) (rebar3)
locked at 1.14.3 (hackney) b5f6f5dc
Doesn't compile with ex_aws v2.1.0
Compiles with ex_aws v2.1.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.