Skip to content
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

Implement AWS KMS cryptography (includes #21) #23

Merged
merged 4 commits into from Aug 8, 2022

Conversation

puiterwijk
Copy link
Contributor

This implements an abstracted signing crypto module that uses an Amazon
Web Services Key Management Service key to sign data.
It supports either KMS or local keys for verification.

Fixes: #5
Signed-off-by: Patrick Uiterwijk patrick@puiterwijk.org

This PR is based on top of #21 and #22.
It can be tested by setting the following environment variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION
  • AWS_KMS_TEST_KEY_ARN - the ARN of the created test key
  • TEST_KEY_SIG_ALG - a signature algorithm (ES256, ES384 or ES512) that this key supports

This test currently does not yet run via GitHub CI, since there's a lack of secrets.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the Apache License Version 2.0, as specified in the LICENSE file of this repository.

@puiterwijk
Copy link
Contributor Author

puiterwijk commented Jul 8, 2021

For transparency: I personally only care about #21 and #22, but I decided to write and submit this one as well to ensure myself the API I designed in #21 allowed for implementing KMS.
I can update this PR if requested, but it's not as important to me if it's decided that this is not the right approach.

@petreeftime petreeftime self-requested a review July 8, 2021 12:46
@puiterwijk
Copy link
Contributor Author

Also, please do note: because the aws_sdk crates are not yet published to crates.io, this introduces a git dependency.
This will mean this cannot be pushed to crates.io once merged.
So perhaps this should go into a separate branch if you want this change, or make use of e.g. Rusoto as AWS client.

@puiterwijk puiterwijk changed the title Implement AWS KMS cryptography Implement AWS KMS cryptography (includes #21) Aug 12, 2021
@petreeftime
Copy link
Contributor

Unfortunately this feature can't be enabled on crates.io yet, until the AWS SDK is pushed to crates.io, so I'll postpone merging this PR until that happens.

@petreeftime
Copy link
Contributor

AWS SDK for Rust is now on crates.io, so this can finally be merged: https://crates.io/crates/aws-sdk-kms.

@petreeftime
Copy link
Contributor

I've rebased the commit here, and made a backup of this commit here in case I managed to break something during rebase, but it seems to be working ok.

@puiterwijk
Copy link
Contributor Author

@petreeftime cool. Do you want me to do a rebase again, or is this set to go in?

@petreeftime
Copy link
Contributor

I wanted to also make the tests run with Github Actions before merging, but I need to create a role and a KMS key in our test account to make it work and didn't quite find time for it.

@puiterwijk
Copy link
Contributor Author

Fair enough. Just let me know if you need me to do anything else.

@justin1121
Copy link

Any progress in getting this merged? Thanks!

@gal-fordefi
Copy link

Any news? We really need this for our deployment.

@petreeftime
Copy link
Contributor

I've rebased the dev branch I had to the latest commit, but I still need to figure out the testing part for this feature.

@petreeftime
Copy link
Contributor

I'll do some manual testing as soon as possible, merge and update the crate version to unblock you, and figure out the automated testing afterwards.

@petreeftime petreeftime force-pushed the crypto-kms branch 5 times, most recently from 86ee534 to e71d8f3 Compare August 5, 2022 15:43
andraprs
andraprs previously approved these changes Aug 8, 2022
src/crypto/kms.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
This implements an abstracted signing crypto module that uses an Amazon
Web Services Key Management Service key to sign data.
It supports either KMS or local keys for verification.

Fixes: awslabs#5
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
Petre Eftime added 2 commits August 8, 2022 10:34
This bumps MSRV to 1.58 to allow adding some new dependencies. These dependencies could
be kept back to some degree but I am unsure whether this would bring value.
At this point, more and more libraries require version 2021, which was introduced
with rust 1.56.

Signed-off-by: Petre Eftime <epetre@amazon.com>
This fixes the build issues that cropped up from integrating other
patches into the repo.

Signed-off-by: Petre Eftime <epetre@amazon.com>
Signed-off-by: Petre Eftime <epetre@amazon.com>
@petreeftime petreeftime merged commit 90ea3cc into awslabs:main Aug 8, 2022
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.

Add support for signing with asymmetric AWS KMS keys
8 participants