Skip to content

Commit d2abf2d

Browse files
Additional support for managing HMAC keys that adheres to changes documented in X9.143-2021 and provides better interoperability for key import/export
1 parent c5eed6a commit d2abf2d

23 files changed

+1158
-339
lines changed

generator/ServiceModels/payment-cryptography/payment-cryptography-2021-09-14.api.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,10 @@
893893
"AES_128",
894894
"AES_192",
895895
"AES_256",
896+
"HMAC_SHA256",
897+
"HMAC_SHA384",
898+
"HMAC_SHA512",
899+
"HMAC_SHA224",
896900
"RSA_2048",
897901
"RSA_3072",
898902
"RSA_4096",
@@ -947,7 +951,8 @@
947951
"type":"string",
948952
"enum":[
949953
"CMAC",
950-
"ANSI_X9_24"
954+
"ANSI_X9_24",
955+
"HMAC"
951956
]
952957
},
953958
"KeyClass":{
@@ -1260,7 +1265,11 @@
12601265
"TDES_3KEY",
12611266
"AES_128",
12621267
"AES_192",
1263-
"AES_256"
1268+
"AES_256",
1269+
"HMAC_SHA256",
1270+
"HMAC_SHA384",
1271+
"HMAC_SHA512",
1272+
"HMAC_SHA224"
12641273
]
12651274
},
12661275
"Tag":{

generator/ServiceModels/payment-cryptography/payment-cryptography-2021-09-14.docs.json

Lines changed: 33 additions & 33 deletions
Large diffs are not rendered by default.

generator/ServiceModels/payment-cryptography/payment-cryptography-2021-09-14.normal.json

Lines changed: 44 additions & 35 deletions
Large diffs are not rendered by default.

sdk/src/Services/PaymentCryptography/Generated/Model/CreateKeyRequest.cs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,36 @@ namespace Amazon.PaymentCryptography.Model
4747
/// The immutable data contains key attributes that define the scope and cryptographic
4848
/// operations that you can perform using the key, for example key class (example: <c>SYMMETRIC_KEY</c>),
4949
/// key algorithm (example: <c>TDES_2KEY</c>), key usage (example: <c>TR31_P0_PIN_ENCRYPTION_KEY</c>)
50-
/// and key modes of use (example: <c>Encrypt</c>). For information about valid combinations
51-
/// of key attributes, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-validattributes.html">Understanding
50+
/// and key modes of use (example: <c>Encrypt</c>). Amazon Web Services Payment Cryptography
51+
/// binds key attributes to keys using key blocks when you store or export them. Amazon
52+
/// Web Services Payment Cryptography stores the key contents wrapped and never stores
53+
/// or transmits them in the clear.
54+
/// </para>
55+
///
56+
/// <para>
57+
/// For information about valid combinations of key attributes, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-validattributes.html">Understanding
5258
/// key attributes</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.
5359
/// The mutable data contained within a key includes usage timestamp and key deletion
5460
/// timestamp and can be modified after creation.
5561
/// </para>
5662
///
5763
/// <para>
58-
/// Amazon Web Services Payment Cryptography binds key attributes to keys using key blocks
59-
/// when you store or export them. Amazon Web Services Payment Cryptography stores the
60-
/// key contents wrapped and never stores or transmits them in the clear.
64+
/// You can use the <c>CreateKey</c> operation to generate an ECC (Elliptic Curve Cryptography)
65+
/// key pair used for establishing an ECDH (Elliptic Curve Diffie-Hellman) key agreement
66+
/// between two parties. In the ECDH key agreement process, both parties generate their
67+
/// own ECC key pair with key usage K3 and exchange the public keys. Each party then use
68+
/// their private key, the received public key from the other party, and the key derivation
69+
/// parameters including key derivation function, hash algorithm, derivation data, and
70+
/// key algorithm to derive a shared key.
71+
/// </para>
72+
///
73+
/// <para>
74+
/// To maintain the single-use principle of cryptographic keys in payments, ECDH derived
75+
/// keys should not be used for multiple purposes, such as a <c>TR31_P0_PIN_ENCRYPTION_KEY</c>
76+
/// and <c>TR31_K1_KEY_BLOCK_PROTECTION_KEY</c>. When creating ECC key pairs in Amazon
77+
/// Web Services Payment Cryptography you can optionally set the <c>DeriveKeyUsage</c>
78+
/// parameter, which defines the key usage bound to the symmetric key that will be derived
79+
/// using the ECC key pair.
6180
/// </para>
6281
///
6382
/// <para>
@@ -97,8 +116,12 @@ public partial class CreateKeyRequest : AmazonPaymentCryptographyRequest
97116
/// <summary>
98117
/// Gets and sets the property DeriveKeyUsage.
99118
/// <para>
100-
/// The cryptographic usage of an ECDH derived key as defined in section A.5.2 of the TR-31
101-
/// spec.
119+
/// The intended cryptographic usage of keys derived from the ECC key pair to be created.
120+
/// </para>
121+
///
122+
/// <para>
123+
/// After creating an ECC key pair, you cannot change the intended cryptographic usage
124+
/// of keys derived from it using ECDH.
102125
/// </para>
103126
/// </summary>
104127
public DeriveKeyUsage DeriveKeyUsage

sdk/src/Services/PaymentCryptography/Generated/Model/DiffieHellmanDerivationData.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
namespace Amazon.PaymentCryptography.Model
3131
{
3232
/// <summary>
33-
/// Derivation data used to derive an ECDH key.
33+
/// The shared information used when deriving a key using ECDH.
3434
/// </summary>
3535
public partial class DiffieHellmanDerivationData
3636
{
@@ -39,14 +39,15 @@ public partial class DiffieHellmanDerivationData
3939
/// <summary>
4040
/// Gets and sets the property SharedInformation.
4141
/// <para>
42-
/// A byte string containing information that binds the ECDH derived key to the two parties
42+
/// A string containing information that binds the ECDH derived key to the two parties
4343
/// involved or to the context of the key.
4444
/// </para>
4545
///
4646
/// <para>
4747
/// It may include details like identities of the two parties deriving the key, context
48-
/// of the operation, session IDs, and optionally a nonce. It must not contain zero bytes,
49-
/// and re-using shared information for multiple ECDH key derivations is not recommended.
48+
/// of the operation, session IDs, and optionally a nonce. It must not contain zero bytes.
49+
/// It is not recommended to reuse shared information for multiple ECDH key derivations,
50+
/// as it could result in derived key material being the same across different derivations.
5051
/// </para>
5152
/// </summary>
5253
[AWSProperty(Min=2, Max=2048)]

sdk/src/Services/PaymentCryptography/Generated/Model/ExportDiffieHellmanTr31KeyBlock.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
namespace Amazon.PaymentCryptography.Model
3131
{
3232
/// <summary>
33-
/// Parameter information for key material export using the asymmetric ECDH key exchange
34-
/// method.
33+
/// Key derivation parameter information for key material export using asymmetric ECDH
34+
/// key exchange method.
3535
/// </summary>
3636
public partial class ExportDiffieHellmanTr31KeyBlock
3737
{
@@ -47,7 +47,8 @@ public partial class ExportDiffieHellmanTr31KeyBlock
4747
/// <summary>
4848
/// Gets and sets the property CertificateAuthorityPublicKeyIdentifier.
4949
/// <para>
50-
/// The <c>keyARN</c> of the certificate that signed the client's <c>PublicKeyCertificate</c>.
50+
/// The <c>keyARN</c> of the CA that signed the <c>PublicKeyCertificate</c> for the client's
51+
/// receiving ECC key pair.
5152
/// </para>
5253
/// </summary>
5354
[AWSProperty(Required=true, Min=7, Max=322)]
@@ -66,7 +67,7 @@ internal bool IsSetCertificateAuthorityPublicKeyIdentifier()
6667
/// <summary>
6768
/// Gets and sets the property DerivationData.
6869
/// <para>
69-
/// Derivation data used to derive an ECDH key.
70+
/// The shared information used when deriving a key using ECDH.
7071
/// </para>
7172
/// </summary>
7273
[AWSProperty(Required=true)]
@@ -85,7 +86,7 @@ internal bool IsSetDerivationData()
8586
/// <summary>
8687
/// Gets and sets the property DeriveKeyAlgorithm.
8788
/// <para>
88-
/// The key algorithm of the derived ECDH key.
89+
/// The key algorithm of the shared derived ECDH key.
8990
/// </para>
9091
/// </summary>
9192
[AWSProperty(Required=true)]
@@ -119,7 +120,7 @@ internal bool IsSetKeyBlockHeaders()
119120
/// <summary>
120121
/// Gets and sets the property KeyDerivationFunction.
121122
/// <para>
122-
/// The key derivation function to use for deriving a key using ECDH.
123+
/// The key derivation function to use when deriving a key using ECDH.
123124
/// </para>
124125
/// </summary>
125126
[AWSProperty(Required=true)]
@@ -138,7 +139,7 @@ internal bool IsSetKeyDerivationFunction()
138139
/// <summary>
139140
/// Gets and sets the property KeyDerivationHashAlgorithm.
140141
/// <para>
141-
/// The hash type to use for deriving a key using ECDH.
142+
/// The hash type to use when deriving a key using ECDH.
142143
/// </para>
143144
/// </summary>
144145
[AWSProperty(Required=true)]
@@ -157,7 +158,8 @@ internal bool IsSetKeyDerivationHashAlgorithm()
157158
/// <summary>
158159
/// Gets and sets the property PrivateKeyIdentifier.
159160
/// <para>
160-
/// The <c>keyARN</c> of the asymmetric ECC key.
161+
/// The <c>keyARN</c> of the asymmetric ECC key created within Amazon Web Services Payment
162+
/// Cryptography.
161163
/// </para>
162164
/// </summary>
163165
[AWSProperty(Required=true, Min=7, Max=322)]
@@ -176,8 +178,8 @@ internal bool IsSetPrivateKeyIdentifier()
176178
/// <summary>
177179
/// Gets and sets the property PublicKeyCertificate.
178180
/// <para>
179-
/// The client's public key certificate in PEM format (base64 encoded) to use for ECDH
180-
/// key derivation.
181+
/// The public key certificate of the client's receiving ECC key pair, in PEM format (base64
182+
/// encoded), to use for ECDH key derivation.
181183
/// </para>
182184
/// </summary>
183185
[AWSProperty(Required=true, Sensitive=true, Min=1, Max=32768)]

sdk/src/Services/PaymentCryptography/Generated/Model/ExportKeyMaterial.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public partial class ExportKeyMaterial
4343
/// <summary>
4444
/// Gets and sets the property DiffieHellmanTr31KeyBlock.
4545
/// <para>
46-
/// Parameter information for key material export using the asymmetric ECDH key exchange
47-
/// method.
46+
/// Key derivation parameter information for key material export using asymmetric ECDH
47+
/// key exchange method.
4848
/// </para>
4949
/// </summary>
5050
public ExportDiffieHellmanTr31KeyBlock DiffieHellmanTr31KeyBlock

sdk/src/Services/PaymentCryptography/Generated/Model/ExportKeyRequest.cs

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,21 @@ namespace Amazon.PaymentCryptography.Model
4646
/// <para>
4747
/// For symmetric key exchange, Amazon Web Services Payment Cryptography uses the ANSI
4848
/// X9 TR-31 norm in accordance with PCI PIN guidelines. And for asymmetric key exchange,
49-
/// Amazon Web Services Payment Cryptography supports ANSI X9 TR-34 norm and RSA wrap
50-
/// and unwrap key exchange mechanism. Asymmetric key exchange methods are typically used
51-
/// to establish bi-directional trust between the two parties exhanging keys and are used
52-
/// for initial key exchange such as Key Encryption Key (KEK). After which you can export
53-
/// working keys using symmetric method to perform various cryptographic operations within
54-
/// Amazon Web Services Payment Cryptography.
49+
/// Amazon Web Services Payment Cryptography supports ANSI X9 TR-34 norm, RSA unwrap,
50+
/// and ECDH (Elliptic Curve Diffie-Hellman) key exchange mechanisms. Asymmetric key exchange
51+
/// methods are typically used to establish bi-directional trust between the two parties
52+
/// exhanging keys and are used for initial key exchange such as Key Encryption Key (KEK).
53+
/// After which you can export working keys using symmetric method to perform various
54+
/// cryptographic operations within Amazon Web Services Payment Cryptography.
5555
/// </para>
5656
///
5757
/// <para>
58-
/// The TR-34 norm is intended for exchanging 3DES keys only and keys are imported in
59-
/// a WrappedKeyBlock format. Key attributes (such as KeyUsage, KeyAlgorithm, KeyModesOfUse,
60-
/// Exportability) are contained within the key block. With RSA wrap and unwrap, you can
61-
/// exchange both 3DES and AES-128 keys. The keys are imported in a WrappedKeyCryptogram
62-
/// format and you will need to specify the key attributes during import.
58+
/// PCI requires specific minimum key strength of wrapping keys used to protect the keys
59+
/// being exchanged electronically. These requirements can change when PCI standards are
60+
/// revised. The rules specify that wrapping keys used for transport must be at least
61+
/// as strong as the key being protected. For more information on recommended key strength
62+
/// of wrapping keys and key exchange mechanism, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-importexport.html">Importing
63+
/// and exporting keys</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.
6364
/// </para>
6465
///
6566
/// <para>
@@ -113,7 +114,7 @@ namespace Amazon.PaymentCryptography.Model
113114
/// the export payload and the signing public key certificate is provided to KRD to verify
114115
/// the signature. The KRD can import the root certificate into its Hardware Security
115116
/// Module (HSM), as required. The export token and the associated KDH signing certificate
116-
/// expires after 7 days.
117+
/// expires after 30 days.
117118
/// </para>
118119
///
119120
/// <para>
@@ -238,8 +239,50 @@ namespace Amazon.PaymentCryptography.Model
238239
/// </para>
239240
/// </li> </ul>
240241
/// <para>
242+
/// <b>To export working keys using ECDH</b>
243+
/// </para>
244+
///
245+
/// <para>
246+
/// You can also use ECDH key agreement to export working keys in a TR-31 keyblock, where
247+
/// the wrapping key is an ECDH derived key.
248+
/// </para>
249+
///
250+
/// <para>
251+
/// To initiate a TR-31 key export using ECDH, both sides must create an ECC key pair
252+
/// with key usage K3 and exchange public key certificates. In Amazon Web Services Payment
253+
/// Cryptography, you can do this by calling <c>CreateKey</c>. If you have not already
254+
/// done so, you must import the CA chain that issued the receiving public key certificate
255+
/// by calling <c>ImportKey</c> with input <c>RootCertificatePublicKey</c> for root CA
256+
/// or <c>TrustedPublicKey</c> for intermediate CA. You can then complete a TR-31 key
257+
/// export by deriving a shared wrapping key using the service ECC key pair, public certificate
258+
/// of your ECC key pair outside of Amazon Web Services Payment Cryptography, and the
259+
/// key derivation parameters including key derivation function, hash algorithm, derivation
260+
/// data, key algorithm.
261+
/// </para>
262+
/// <ul> <li>
263+
/// <para>
264+
/// <c>KeyMaterial</c>: Use <c>DiffieHellmanTr31KeyBlock</c> parameters.
265+
/// </para>
266+
/// </li> <li>
267+
/// <para>
268+
/// <c>PrivateKeyIdentifier</c>: The <c>KeyArn</c> of the ECC key pair created within
269+
/// Amazon Web Services Payment Cryptography to derive a shared KEK.
270+
/// </para>
271+
/// </li> <li>
272+
/// <para>
273+
/// <c>PublicKeyCertificate</c>: The public key certificate of the receiving ECC key
274+
/// pair in PEM format (base64 encoded) to derive a shared KEK.
275+
/// </para>
276+
/// </li> <li>
277+
/// <para>
278+
/// <c>CertificateAuthorityPublicKeyIdentifier</c>: The <c>keyARN</c> of the CA that
279+
/// signed the public key certificate of the receiving ECC key pair.
280+
/// </para>
281+
/// </li> </ul>
282+
/// <para>
241283
/// When this operation is successful, Amazon Web Services Payment Cryptography returns
242-
/// the working key or IPEK as a TR-31 WrappedKeyBlock.
284+
/// the working key as a TR-31 WrappedKeyBlock, where the wrapping key is the ECDH derived
285+
/// key.
243286
/// </para>
244287
///
245288
/// <para>

sdk/src/Services/PaymentCryptography/Generated/Model/ExportTr34KeyBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ internal bool IsSetCertificateAuthorityPublicKeyIdentifier()
6868
/// The export token to initiate key export from Amazon Web Services Payment Cryptography.
6969
/// It also contains the signing key certificate that will sign the wrapped key during
7070
/// TR-34 key block generation. Call <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetParametersForExport.html">GetParametersForExport</a>
71-
/// to receive an export token. It expires after 7 days. You can use the same export token
72-
/// to export multiple keys from the same service account.
71+
/// to receive an export token. It expires after 30 days. You can use the same export
72+
/// token to export multiple keys from the same service account.
7373
/// </para>
7474
/// </summary>
7575
[AWSProperty(Required=true)]

sdk/src/Services/PaymentCryptography/Generated/Model/GetParametersForExportRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace Amazon.PaymentCryptography.Model
3939
/// The signing key certificate signs the wrapped key under export within the TR-34 key
4040
/// payload. The export token and signing key certificate must be in place and operational
4141
/// before calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ExportKey.html">ExportKey</a>.
42-
/// The export token expires in 7 days. You can use the same export token to export multiple
42+
/// The export token expires in 30 days. You can use the same export token to export multiple
4343
/// keys from your service account.
4444
/// </para>
4545
///

0 commit comments

Comments
 (0)