Giter Club home page Giter Club logo

Comments (2)

nunofernandes avatar nunofernandes commented on July 23, 2024 1

Hello,

I'm also having the same issue. The script that I have works with AWS but fails with localstack. Here's the script that I use:

awslocal kms create-key --origin EXTERNAL --description "MyImportedKey6" --key-usage SIGN_VERIFY --key-spec RSA_4096 --output json > kms.json

awslocal kms get-parameters-for-import --key-id $(cat kms.json | jq -r '.KeyMetadata.KeyId') --wrapping-algorithm RSA_AES_KEY_WRAP_SHA_256 --wrapping-key-spec RSA_4096 > import.txt

openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:4096 | openssl pkcs8 -topk8 -outform der -nocrypt > RSA_4096_PrivateKey.der

openssl rand -out aes-key.bin 32

openssl enc -id-aes256-wrap-pad -K "$(xxd -p < aes-key.bin | tr -d '\n')" -iv A65959A6 -in RSA_4096_PrivateKey.der -out key-material-wrapped.bin

openssl pkeyutl -encrypt -in aes-key.bin -out aes-key-wrapped.bin -inkey <(jq -r '.PublicKey' import.txt | base64 -d) -keyform DER -pubin -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256

cat aes-key-wrapped.bin key-material-wrapped.bin > EncryptedKeyMaterial.bin

awslocal kms import-key-material --key-id $(cat kms.json | jq -r '.KeyMetadata.KeyId') --encrypted-key-material fileb://EncryptedKeyMaterial.bin --import-token fileb://<(jq -r '.ImportToken' import.txt | base64 -d) --expiration-model KEY_MATERIAL_DOES_NOT_EXPIRE

An error occurred (KMSInvalidStateException) when calling the ImportKeyMaterial operation: Unsupported padding, requested wrapping algorithm:'RSA_AES_KEY_WRAP_SHA_256'
make: *** [Makefile:45: import-key] Error 255

This same script works with AWS.

Thank you!

from localstack.

localstack-bot avatar localstack-bot commented on July 23, 2024

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

from localstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.