Signing >4096 byte Messages With KMS Asymmetric Key Pair

0

I'm looking to generate a digital signature HTTP response header for some of our REST APIs that return JSON. The original idea was to use KMS to store an asymmetric key pair(ECC_NIST_P256) and generate a signature given the response data and the ARN of the key pair that's stored. However, KMS will only sign 4096 bytes of data. For larger messages the guidance is to generate a message digest and sign that, but we need to sign the entire response.

So then I wanted to just use KMS to manage the keys and sign it "manually" via java.security classes in my application outside of KMS. However, if I'm going to do the signing I need the private key from the keypair, and so far it doesn't seem like there's a way for me to get at it(the api mentions the private key of an asymmetric key never leaves KMS unencrypted, and I don't see a method to get at it using the java SDK). We probably could import an existing asymmetric key into KMS, but then I'd have to have some other way of getting the private key bytes when signing rather than going through KMS, so that wouldn't really help.

So is it not possible for me to digitally sign my >4096 byte responses with an asymmetric key pair in KMS without having to store the private key separately?

mford
已提問 1 年前檢視次數 662 次
1 個回答
0

You can use GenerateDataKeyPair API to create private/public key pair you can use outside of AWS KMS. The private key is encrypted under a symmetric KMS key. To use the private key, you would need to call Decrypt API on the private key to get plaintext private key back. This solution works if your use case does not involve encrypting/decrypting within FIPS boundary.

For larger messages the guidance is to generate a message digest and sign that, but we need to sign the entire response.

Could you elaborate on this a little more? Curious to know why you need to sign the entire response. Also, how big is your response on average?

AWS
已回答 1 年前
  • Signing the entire response was the original API customer requirement, but after some inquiries we were able to get sign-off on generating a message digest and just signing that. FYI our responses are around 600-700K.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南