From f7acac4f71ed43b3a0bb88240e7950ecc654efc1 Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 16 Jan 2024 19:18:31 +0000 Subject: [PATCH] feat(client-payment-cryptography): Provide an additional option for key exchange using RSA wrap/unwrap in addition to tr-34/tr-31 in ImportKey and ExportKey operations. Added new key usage (type) TR31_M1_ISO_9797_1_MAC_KEY, for use with Generate/VerifyMac dataplane operations with ISO9797 Algorithm 1 MAC calculations. --- .../src/commands/ExportKeyCommand.ts | 35 ++++- .../commands/GetParametersForImportCommand.ts | 2 +- .../src/commands/ImportKeyCommand.ts | 35 ++++- .../src/models/models_0.ts | 137 +++++++++++++++++- .../src/protocols/Aws_json1_0.ts | 6 + .../aws-models/payment-cryptography.json | 132 +++++++++++++++-- 6 files changed, 322 insertions(+), 25 deletions(-) diff --git a/clients/client-payment-cryptography/src/commands/ExportKeyCommand.ts b/clients/client-payment-cryptography/src/commands/ExportKeyCommand.ts index 0067786b5d2b..437e888b2e84 100644 --- a/clients/client-payment-cryptography/src/commands/ExportKeyCommand.ts +++ b/clients/client-payment-cryptography/src/commands/ExportKeyCommand.ts @@ -39,11 +39,11 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare * @public *

Exports a key from Amazon Web Services Payment Cryptography.

*

Amazon Web Services Payment Cryptography simplifies key exchange by replacing the existing paper-based approach with a modern electronic approach. With ExportKey you can export symmetric keys using either symmetric and asymmetric key exchange mechanisms. Using this operation, you can share your Amazon Web Services Payment Cryptography generated keys with other service partners to perform cryptographic operations outside of Amazon Web Services Payment Cryptography

- *

For symmetric key exchange, Amazon Web Services Payment Cryptography uses the ANSI X9 TR-31 norm in accordance with PCI PIN guidelines. And for asymmetric key exchange, Amazon Web Services Payment Cryptography supports ANSI X9 TR-34 norm . Asymmetric key exchange methods are typically used to establish bi-directional trust between the two parties exhanging keys and are used for initial key exchange such as Key Encryption Key (KEK). After which you can export working keys using symmetric method to perform various cryptographic operations within Amazon Web Services Payment Cryptography.

- *

The TR-34 norm is intended for exchanging 3DES keys only and keys are imported in a WrappedKeyBlock format. Key attributes (such as KeyUsage, KeyAlgorithm, KeyModesOfUse, Exportability) are contained within the key block.

+ *

For symmetric key exchange, Amazon Web Services Payment Cryptography uses the ANSI X9 TR-31 norm in accordance with PCI PIN guidelines. And for asymmetric key exchange, Amazon Web Services Payment Cryptography supports ANSI X9 TR-34 norm and RSA wrap and unwrap key exchange mechanism. Asymmetric key exchange methods are typically used to establish bi-directional trust between the two parties exhanging keys and are used for initial key exchange such as Key Encryption Key (KEK). After which you can export working keys using symmetric method to perform various cryptographic operations within Amazon Web Services Payment Cryptography.

+ *

The TR-34 norm is intended for exchanging 3DES keys only and keys are imported in a WrappedKeyBlock format. Key attributes (such as KeyUsage, KeyAlgorithm, KeyModesOfUse, Exportability) are contained within the key block. With RSA wrap and unwrap, you can exchange both 3DES and AES-128 keys. The keys are imported in a WrappedKeyCryptogram format and you will need to specify the key attributes during import.

*

You can also use ExportKey functionality to generate and export an IPEK (Initial Pin Encryption Key) from Amazon Web Services Payment Cryptography using either TR-31 or TR-34 export key exchange. IPEK is generated from BDK (Base Derivation Key) and ExportDukptInitialKey attribute KSN (KeySerialNumber). The generated IPEK does not persist within Amazon Web Services Payment Cryptography and has to be re-generated each time during export.

*

- * To export KEK or IPEK using TR-34 + * To export initial keys (KEK) or IPEK using TR-34 *

*

Using this operation, you can export initial key using TR-34 asymmetric key exchange. You can only export KEK generated within Amazon Web Services Payment Cryptography. In TR-34 terminology, the sending party of the key is called Key Distribution Host (KDH) and the receiving party of the key is called Key Receiving Device (KRD). During key export process, KDH is Amazon Web Services Payment Cryptography which initiates key export and KRD is the user receiving the key.

*

To initiate TR-34 key export, the KRD must obtain an export token by calling GetParametersForExport. This operation also generates a key pair for the purpose of key export, signs the key and returns back the signing public key certificate (also known as KDH signing certificate) and root certificate chain. The KDH uses the private key to sign the the export payload and the signing public key certificate is provided to KRD to verify the signature. The KRD can import the root certificate into its Hardware Security Module (HSM), as required. The export token and the associated KDH signing certificate expires after 7 days.

@@ -77,7 +77,27 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare * *

When this operation is successful, Amazon Web Services Payment Cryptography returns the KEK or IPEK as a TR-34 WrappedKeyBlock.

*

- * To export WK (Working Key) or IPEK using TR-31 + * To export initial keys (KEK) or IPEK using RSA Wrap and Unwrap + *

+ *

Using this operation, you can export initial key using asymmetric RSA wrap and unwrap key exchange method. To initiate export, generate an asymmetric key pair on the receiving HSM and obtain the public key certificate in PEM format (base64 encoded) for the purpose of wrapping and the root certifiate chain. Import the root certificate into Amazon Web Services Payment Cryptography by calling ImportKey for RootCertificatePublicKey.

+ *

Next call ExportKey and set the following parameters:

+ * + *

When this operation is successful, Amazon Web Services Payment Cryptography returns the WrappedKeyCryptogram.

+ *

+ * To export working keys or IPEK using TR-31 *

*

Using this operation, you can export working keys or IPEK using TR-31 symmetric key exchange. In TR-31, you must use an initial key such as KEK to encrypt or wrap the key under export. To establish a KEK, you can use CreateKey or ImportKey.

*

Set the following parameters:

@@ -95,7 +115,7 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare * KeyMaterial: Use Tr31KeyBlock parameters.

* * - *

When this operation is successful, Amazon Web Services Payment Cryptography returns the WK or IPEK as a TR-31 WrappedKeyBlock.

+ *

When this operation is successful, Amazon Web Services Payment Cryptography returns the working key or IPEK as a TR-31 WrappedKeyBlock.

*

* Cross-account use: This operation can't be used across different Amazon Web Services accounts.

*

@@ -131,6 +151,11 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare * KeyBlockFormat: "STRING_VALUE", // required * RandomNonce: "STRING_VALUE", * }, + * KeyCryptogram: { // ExportKeyCryptogram + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * WrappingKeyCertificate: "STRING_VALUE", // required + * WrappingSpec: "STRING_VALUE", + * }, * }, * ExportKeyIdentifier: "STRING_VALUE", // required * ExportAttributes: { // ExportAttributes diff --git a/clients/client-payment-cryptography/src/commands/GetParametersForImportCommand.ts b/clients/client-payment-cryptography/src/commands/GetParametersForImportCommand.ts index cc04fba4d878..ad8876b1cb3b 100644 --- a/clients/client-payment-cryptography/src/commands/GetParametersForImportCommand.ts +++ b/clients/client-payment-cryptography/src/commands/GetParametersForImportCommand.ts @@ -36,7 +36,7 @@ export interface GetParametersForImportCommandOutput extends GetParametersForImp /** * @public - *

Gets the import token and the wrapping key certificate in PEM format (base64 encoded) to initiate a TR-34 WrappedKeyBlock.

+ *

Gets the import token and the wrapping key certificate in PEM format (base64 encoded) to initiate a TR-34 WrappedKeyBlock or a RSA WrappedKeyCryptogram import into Amazon Web Services Payment Cryptography.

*

The wrapping key certificate wraps the key under import. The import token and wrapping key certificate must be in place and operational before calling ImportKey. The import token expires in 7 days. You can use the same import token to import multiple keys into your service account.

*

* Cross-account use: This operation can't be used across different Amazon Web Services accounts.

diff --git a/clients/client-payment-cryptography/src/commands/ImportKeyCommand.ts b/clients/client-payment-cryptography/src/commands/ImportKeyCommand.ts index ad860c7c9cd7..d7965c534432 100644 --- a/clients/client-payment-cryptography/src/commands/ImportKeyCommand.ts +++ b/clients/client-payment-cryptography/src/commands/ImportKeyCommand.ts @@ -34,8 +34,8 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare * @public *

Imports symmetric keys and public key certificates in PEM format (base64 encoded) into Amazon Web Services Payment Cryptography.

*

Amazon Web Services Payment Cryptography simplifies key exchange by replacing the existing paper-based approach with a modern electronic approach. With ImportKey you can import symmetric keys using either symmetric and asymmetric key exchange mechanisms.

- *

For symmetric key exchange, Amazon Web Services Payment Cryptography uses the ANSI X9 TR-31 norm in accordance with PCI PIN guidelines. And for asymmetric key exchange, Amazon Web Services Payment Cryptography supports ANSI X9 TR-34 norm . Asymmetric key exchange methods are typically used to establish bi-directional trust between the two parties exhanging keys and are used for initial key exchange such as Key Encryption Key (KEK) or Zone Master Key (ZMK). After which you can import working keys using symmetric method to perform various cryptographic operations within Amazon Web Services Payment Cryptography.

- *

The TR-34 norm is intended for exchanging 3DES keys only and keys are imported in a WrappedKeyBlock format. Key attributes (such as KeyUsage, KeyAlgorithm, KeyModesOfUse, Exportability) are contained within the key block.

+ *

For symmetric key exchange, Amazon Web Services Payment Cryptography uses the ANSI X9 TR-31 norm in accordance with PCI PIN guidelines. And for asymmetric key exchange, Amazon Web Services Payment Cryptography supports ANSI X9 TR-34 norm and RSA wrap and unwrap key exchange mechanisms. Asymmetric key exchange methods are typically used to establish bi-directional trust between the two parties exhanging keys and are used for initial key exchange such as Key Encryption Key (KEK) or Zone Master Key (ZMK). After which you can import working keys using symmetric method to perform various cryptographic operations within Amazon Web Services Payment Cryptography.

+ *

The TR-34 norm is intended for exchanging 3DES keys only and keys are imported in a WrappedKeyBlock format. Key attributes (such as KeyUsage, KeyAlgorithm, KeyModesOfUse, Exportability) are contained within the key block. With RSA wrap and unwrap, you can exchange both 3DES and AES-128 keys. The keys are imported in a WrappedKeyCryptogram format and you will need to specify the key attributes during import.

*

You can also import a root public key certificate, used to sign other public key certificates, or a trusted public key certificate under an already established root public key certificate.

*

* To import a public root key certificate @@ -96,7 +96,7 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare * * *

- * To import KEK or ZMK using TR-34 + * To import initial keys (KEK or ZMK or similar) using TR-34 *

*

Using this operation, you can import initial key using TR-34 asymmetric key exchange. In TR-34 terminology, the sending party of the key is called Key Distribution Host (KDH) and the receiving party of the key is called Key Receiving Device (KRD). During the key import process, KDH is the user who initiates the key import and KRD is Amazon Web Services Payment Cryptography who receives the key.

*

To initiate TR-34 key import, the KDH must obtain an import token by calling GetParametersForImport. This operation generates an encryption keypair for the purpose of key import, signs the key and returns back the wrapping key certificate (also known as KRD wrapping certificate) and the root certificate chain. The KDH must trust and install the KRD wrapping certificate on its HSM and use it to encrypt (wrap) the KDH key during TR-34 WrappedKeyBlock generation. The import token and associated KRD wrapping certificate expires after 7 days.

@@ -125,7 +125,12 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare * * *

- * To import WK (Working Key) using TR-31 + * To import initial keys (KEK or ZMK or similar) using RSA Wrap and Unwrap + *

+ *

Using this operation, you can import initial key using asymmetric RSA wrap and unwrap key exchange method. To initiate import, call GetParametersForImport with KeyMaterial set to KEY_CRYPTOGRAM to generate an import token. This operation also generates an encryption keypair for the purpose of key import, signs the key and returns back the wrapping key certificate in PEM format (base64 encoded) and its root certificate chain. The import token and associated KRD wrapping certificate expires after 7 days.

+ *

You must trust and install the wrapping certificate and its certificate chain on the sending HSM and use it to wrap the key under export for WrappedKeyCryptogram generation. Next call ImportKey with KeyMaterial set to KEY_CRYPTOGRAM and provide the ImportToken and KeyAttributes for the key under import.

+ *

+ * To import working keys using TR-31 *

*

Amazon Web Services Payment Cryptography uses TR-31 symmetric key exchange norm to import working keys. A KEK must be established within Amazon Web Services Payment Cryptography by using TR-34 key import or by using CreateKey. To initiate a TR-31 key import, set the following parameters:

*