From 2f74e23b71cd5960b1ac0404ce39d62a42a3aa64 Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 23 Oct 2024 19:52:03 +0000 Subject: [PATCH] feat(client-payment-cryptography-data): Add ECDH support on PIN operations. --- .../README.md | 2 +- .../src/commands/DecryptDataCommand.ts | 8 + .../src/commands/EncryptDataCommand.ts | 8 + .../src/commands/GeneratePinDataCommand.ts | 17 +- .../src/commands/ReEncryptDataCommand.ts | 16 ++ .../src/commands/TranslatePinDataCommand.ts | 22 ++- .../src/commands/VerifyPinDataCommand.ts | 16 +- .../src/models/models_0.ts | 141 +++++++++++++- .../src/protocols/Aws_restJson1.ts | 5 + .../aws-models/payment-cryptography-data.json | 176 +++++++++++++++++- 10 files changed, 396 insertions(+), 15 deletions(-) diff --git a/clients/client-payment-cryptography-data/README.md b/clients/client-payment-cryptography-data/README.md index 09a8358d9cfd..a9df7ff73445 100644 --- a/clients/client-payment-cryptography-data/README.md +++ b/clients/client-payment-cryptography-data/README.md @@ -11,7 +11,7 @@ AWS SDK for JavaScript PaymentCryptographyData Client for Node.js, Browser and R ## Installing -To install the this package, simply type add or install @aws-sdk/client-payment-cryptography-data +To install this package, simply type add or install @aws-sdk/client-payment-cryptography-data using your favorite package manager: - `npm install @aws-sdk/client-payment-cryptography-data` diff --git a/clients/client-payment-cryptography-data/src/commands/DecryptDataCommand.ts b/clients/client-payment-cryptography-data/src/commands/DecryptDataCommand.ts index f7e47550eca6..3d82f5b62900 100644 --- a/clients/client-payment-cryptography-data/src/commands/DecryptDataCommand.ts +++ b/clients/client-payment-cryptography-data/src/commands/DecryptDataCommand.ts @@ -102,6 +102,14 @@ export interface DecryptDataCommandOutput extends DecryptDataOutput, __MetadataB * WrappedKey: { // WrappedKey * WrappedKeyMaterial: { // WrappedKeyMaterial Union: only one key present * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { // EcdhDerivationAttributes + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, * }, * KeyCheckValueAlgorithm: "STRING_VALUE", * }, diff --git a/clients/client-payment-cryptography-data/src/commands/EncryptDataCommand.ts b/clients/client-payment-cryptography-data/src/commands/EncryptDataCommand.ts index 2c3ae6af38fd..6b6d535c1400 100644 --- a/clients/client-payment-cryptography-data/src/commands/EncryptDataCommand.ts +++ b/clients/client-payment-cryptography-data/src/commands/EncryptDataCommand.ts @@ -109,6 +109,14 @@ export interface EncryptDataCommandOutput extends EncryptDataOutput, __MetadataB * WrappedKey: { // WrappedKey * WrappedKeyMaterial: { // WrappedKeyMaterial Union: only one key present * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { // EcdhDerivationAttributes + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, * }, * KeyCheckValueAlgorithm: "STRING_VALUE", * }, diff --git a/clients/client-payment-cryptography-data/src/commands/GeneratePinDataCommand.ts b/clients/client-payment-cryptography-data/src/commands/GeneratePinDataCommand.ts index 8da9eb1f1297..6857ce1d3998 100644 --- a/clients/client-payment-cryptography-data/src/commands/GeneratePinDataCommand.ts +++ b/clients/client-payment-cryptography-data/src/commands/GeneratePinDataCommand.ts @@ -39,6 +39,7 @@ export interface GeneratePinDataCommandOutput extends GeneratePinDataOutput, __M /** *

Generates pin-related data such as PIN, PIN Verification Value (PVV), PIN Block, and PIN Offset during new card issuance or reissuance. For more information, see Generate PIN data in the Amazon Web Services Payment Cryptography User Guide.

*

PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation generates PIN, PVV, or PIN Offset and then encrypts it using Pin Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. This operation uses a separate Pin Verification Key (PVK) for VISA PVV generation.

+ *

Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block. You can also use it for reveal PIN, wherein the generated PIN block is protected by the ECDH derived key before transmission from Amazon Web Services Payment Cryptography. For more information on establishing ECDH derived keys, see the Generating keys in the Amazon Web Services Payment Cryptography User Guide.

*

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

*

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

@@ -104,7 +105,21 @@ export interface GeneratePinDataCommandOutput extends GeneratePinDataOutput, __M * }, * PinDataLength: Number("int"), * PrimaryAccountNumber: "STRING_VALUE", // required - * PinBlockFormat: "ISO_FORMAT_0" || "ISO_FORMAT_3", // required + * PinBlockFormat: "ISO_FORMAT_0" || "ISO_FORMAT_3" || "ISO_FORMAT_4", // required + * EncryptionWrappedKey: { // WrappedKey + * WrappedKeyMaterial: { // WrappedKeyMaterial Union: only one key present + * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { // EcdhDerivationAttributes + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, + * }, + * KeyCheckValueAlgorithm: "STRING_VALUE", + * }, * }; * const command = new GeneratePinDataCommand(input); * const response = await client.send(command); diff --git a/clients/client-payment-cryptography-data/src/commands/ReEncryptDataCommand.ts b/clients/client-payment-cryptography-data/src/commands/ReEncryptDataCommand.ts index 8b484ca4c230..82b779b6bf52 100644 --- a/clients/client-payment-cryptography-data/src/commands/ReEncryptDataCommand.ts +++ b/clients/client-payment-cryptography-data/src/commands/ReEncryptDataCommand.ts @@ -110,12 +110,28 @@ export interface ReEncryptDataCommandOutput extends ReEncryptDataOutput, __Metad * IncomingWrappedKey: { // WrappedKey * WrappedKeyMaterial: { // WrappedKeyMaterial Union: only one key present * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { // EcdhDerivationAttributes + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, * }, * KeyCheckValueAlgorithm: "STRING_VALUE", * }, * OutgoingWrappedKey: { * WrappedKeyMaterial: {// Union: only one key present * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, * }, * KeyCheckValueAlgorithm: "STRING_VALUE", * }, diff --git a/clients/client-payment-cryptography-data/src/commands/TranslatePinDataCommand.ts b/clients/client-payment-cryptography-data/src/commands/TranslatePinDataCommand.ts index d53e6185e084..8c2cdcc25172 100644 --- a/clients/client-payment-cryptography-data/src/commands/TranslatePinDataCommand.ts +++ b/clients/client-payment-cryptography-data/src/commands/TranslatePinDataCommand.ts @@ -38,8 +38,10 @@ export interface TranslatePinDataCommandOutput extends TranslatePinDataOutput, _ /** *

Translates encrypted PIN block from and to ISO 9564 formats 0,1,3,4. For more information, see Translate PIN data in the Amazon Web Services Payment Cryptography User Guide.

- *

PIN block translation involves changing the encrytion of PIN block from one encryption key to another encryption key and changing PIN block format from one to another without PIN block data leaving Amazon Web Services Payment Cryptography. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK. Amazon Web Services Payment Cryptography supports TDES and AES key derivation type for DUKPT translations.

- *

This operation also supports dynamic keys, allowing you to pass a dynamic PEK as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To translate PIN block using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide.

+ *

PIN block translation involves changing a PIN block from one encryption key to another and optionally change its format. PIN block translation occurs entirely within the HSM boundary and PIN data never enters or leaves Amazon Web Services Payment Cryptography in clear text. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK.

+ *

Amazon Web Services Payment Cryptography also supports use of dynamic keys and ECDH (Elliptic Curve Diffie-Hellman) based key exchange for this operation.

+ *

Dynamic keys allow you to pass a PEK as a TR-31 WrappedKeyBlock. They can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To translate PIN block using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide.

+ *

Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block, which is translated to a PEK encrypted PIN block for use within the service. You can also use ECDH for reveal PIN, wherein the service translates the PIN block from PEK to a ECDH derived encryption key. For more information on establishing ECDH derived keys, see the Generating keys in the Amazon Web Services Payment Cryptography User Guide.

*

The allowed combinations of PIN block format translations are guided by PCI. It is important to note that not all encrypted PIN block formats (example, format 1) require PAN (Primary Account Number) as input. And as such, PIN block format that requires PAN (example, formats 0,3,4) cannot be translated to a format (format 1) that does not require a PAN for generation.

*

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

* @@ -107,12 +109,28 @@ export interface TranslatePinDataCommandOutput extends TranslatePinDataOutput, _ * IncomingWrappedKey: { // WrappedKey * WrappedKeyMaterial: { // WrappedKeyMaterial Union: only one key present * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { // EcdhDerivationAttributes + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, * }, * KeyCheckValueAlgorithm: "STRING_VALUE", * }, * OutgoingWrappedKey: { * WrappedKeyMaterial: {// Union: only one key present * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, * }, * KeyCheckValueAlgorithm: "STRING_VALUE", * }, diff --git a/clients/client-payment-cryptography-data/src/commands/VerifyPinDataCommand.ts b/clients/client-payment-cryptography-data/src/commands/VerifyPinDataCommand.ts index c4bb2497f0b2..f1df2c8da747 100644 --- a/clients/client-payment-cryptography-data/src/commands/VerifyPinDataCommand.ts +++ b/clients/client-payment-cryptography-data/src/commands/VerifyPinDataCommand.ts @@ -75,12 +75,26 @@ export interface VerifyPinDataCommandOutput extends VerifyPinDataOutput, __Metad * }, * EncryptedPinBlock: "STRING_VALUE", // required * PrimaryAccountNumber: "STRING_VALUE", // required - * PinBlockFormat: "ISO_FORMAT_0" || "ISO_FORMAT_3", // required + * PinBlockFormat: "ISO_FORMAT_0" || "ISO_FORMAT_3" || "ISO_FORMAT_4", // required * PinDataLength: Number("int"), * DukptAttributes: { // DukptAttributes * KeySerialNumber: "STRING_VALUE", // required * DukptDerivationType: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required * }, + * EncryptionWrappedKey: { // WrappedKey + * WrappedKeyMaterial: { // WrappedKeyMaterial Union: only one key present + * Tr31KeyBlock: "STRING_VALUE", + * DiffieHellmanSymmetricKey: { // EcdhDerivationAttributes + * CertificateAuthorityPublicKeyIdentifier: "STRING_VALUE", // required + * PublicKeyCertificate: "STRING_VALUE", // required + * KeyAlgorithm: "TDES_2KEY" || "TDES_3KEY" || "AES_128" || "AES_192" || "AES_256", // required + * KeyDerivationFunction: "NIST_SP800" || "ANSI_X963", // required + * KeyDerivationHashAlgorithm: "SHA_256" || "SHA_384" || "SHA_512", // required + * SharedInformation: "STRING_VALUE", // required + * }, + * }, + * KeyCheckValueAlgorithm: "STRING_VALUE", + * }, * }; * const command = new VerifyPinDataCommand(input); * const response = await client.send(command); diff --git a/clients/client-payment-cryptography-data/src/models/models_0.ts b/clients/client-payment-cryptography-data/src/models/models_0.ts index d739d16d1181..1bec52c9eeb5 100644 --- a/clients/client-payment-cryptography-data/src/models/models_0.ts +++ b/clients/client-payment-cryptography-data/src/models/models_0.ts @@ -1041,11 +1041,103 @@ export const KeyCheckValueAlgorithm = { */ export type KeyCheckValueAlgorithm = (typeof KeyCheckValueAlgorithm)[keyof typeof KeyCheckValueAlgorithm]; +/** + * @public + * @enum + */ +export const SymmetricKeyAlgorithm = { + AES_128: "AES_128", + AES_192: "AES_192", + AES_256: "AES_256", + TDES_2KEY: "TDES_2KEY", + TDES_3KEY: "TDES_3KEY", +} as const; + +/** + * @public + */ +export type SymmetricKeyAlgorithm = (typeof SymmetricKeyAlgorithm)[keyof typeof SymmetricKeyAlgorithm]; + +/** + * @public + * @enum + */ +export const KeyDerivationFunction = { + ANSI_X963: "ANSI_X963", + NIST_SP800: "NIST_SP800", +} as const; + +/** + * @public + */ +export type KeyDerivationFunction = (typeof KeyDerivationFunction)[keyof typeof KeyDerivationFunction]; + +/** + * @public + * @enum + */ +export const KeyDerivationHashAlgorithm = { + SHA_256: "SHA_256", + SHA_384: "SHA_384", + SHA_512: "SHA_512", +} as const; + +/** + * @public + */ +export type KeyDerivationHashAlgorithm = (typeof KeyDerivationHashAlgorithm)[keyof typeof KeyDerivationHashAlgorithm]; + +/** + *

Parameters required to establish ECDH based key exchange.

+ * @public + */ +export interface EcdhDerivationAttributes { + /** + *

The keyArn of the certificate that signed the client's PublicKeyCertificate.

+ * @public + */ + CertificateAuthorityPublicKeyIdentifier: string | undefined; + + /** + *

The client's public key certificate in PEM format (base64 encoded) to use for ECDH key derivation.

+ * @public + */ + PublicKeyCertificate: string | undefined; + + /** + *

The key algorithm of the derived ECDH key.

+ * @public + */ + KeyAlgorithm: SymmetricKeyAlgorithm | undefined; + + /** + *

The key derivation function to use for deriving a key using ECDH.

+ * @public + */ + KeyDerivationFunction: KeyDerivationFunction | undefined; + + /** + *

The hash type to use for deriving a key using ECDH.

+ * @public + */ + KeyDerivationHashAlgorithm: KeyDerivationHashAlgorithm | undefined; + + /** + *

A byte string containing information that binds the ECDH derived key to the two parties involved or to the context of the key.

+ *

It may include details like identities of the two parties deriving the key, context of the operation, session IDs, and optionally a nonce. It must not contain zero bytes, and re-using shared information for multiple ECDH key derivations is not recommended.

+ * @public + */ + SharedInformation: string | undefined; +} + /** *

Parameter information of a WrappedKeyBlock for encryption key exchange.

* @public */ -export type WrappedKeyMaterial = WrappedKeyMaterial.Tr31KeyBlockMember | WrappedKeyMaterial.$UnknownMember; +export type WrappedKeyMaterial = + | WrappedKeyMaterial.DiffieHellmanSymmetricKeyMember + | WrappedKeyMaterial.Tr31KeyBlockMember + | WrappedKeyMaterial.$UnknownMember; /** * @public @@ -1057,6 +1149,17 @@ export namespace WrappedKeyMaterial { */ export interface Tr31KeyBlockMember { Tr31KeyBlock: string; + DiffieHellmanSymmetricKey?: never; + $unknown?: never; + } + + /** + *

The parameter information for deriving a ECDH shared key.

+ * @public + */ + export interface DiffieHellmanSymmetricKeyMember { + Tr31KeyBlock?: never; + DiffieHellmanSymmetricKey: EcdhDerivationAttributes; $unknown?: never; } @@ -1065,16 +1168,20 @@ export namespace WrappedKeyMaterial { */ export interface $UnknownMember { Tr31KeyBlock?: never; + DiffieHellmanSymmetricKey?: never; $unknown: [string, any]; } export interface Visitor { Tr31KeyBlock: (value: string) => T; + DiffieHellmanSymmetricKey: (value: EcdhDerivationAttributes) => T; _: (name: string, value: any) => T; } export const visit = (value: WrappedKeyMaterial, visitor: Visitor): T => { if (value.Tr31KeyBlock !== undefined) return visitor.Tr31KeyBlock(value.Tr31KeyBlock); + if (value.DiffieHellmanSymmetricKey !== undefined) + return visitor.DiffieHellmanSymmetricKey(value.DiffieHellmanSymmetricKey); return visitor._(value.$unknown[0], value.$unknown[1]); }; } @@ -2462,6 +2569,7 @@ export namespace PinGenerationAttributes { export const PinBlockFormatForPinData = { ISO_FORMAT_0: "ISO_FORMAT_0", ISO_FORMAT_3: "ISO_FORMAT_3", + ISO_FORMAT_4: "ISO_FORMAT_4", } as const; /** @@ -2480,7 +2588,7 @@ export interface GeneratePinDataInput { GenerationKeyIdentifier: string | undefined; /** - *

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses to encrypt the PIN Block.

+ *

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses to encrypt the PIN Block. For ECDH, it is the keyARN of the asymmetric ECC key.

* @public */ EncryptionKeyIdentifier: string | undefined; @@ -2510,6 +2618,12 @@ export interface GeneratePinDataInput { * @public */ PinBlockFormat: PinBlockFormatForPinData | undefined; + + /** + *

Parameter information of a WrappedKeyBlock for encryption key exchange.

+ * @public + */ + EncryptionWrappedKey?: WrappedKey; } /** @@ -2582,7 +2696,7 @@ export interface GeneratePinDataOutput { GenerationKeyCheckValue: string | undefined; /** - *

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for encrypted pin block generation.

+ *

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for encrypted pin block generation. For ECDH, it is the keyARN of the asymmetric ECC key.

* @public */ EncryptionKeyArn: string | undefined; @@ -2879,13 +2993,14 @@ export namespace TranslationIsoFormats { export interface TranslatePinDataInput { /** *

The keyARN of the encryption key under which incoming PIN block data is encrypted. This key type can be PEK or BDK.

- *

When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key for PIN block. Otherwise, it is the key identifier used to perform the operation.

+ *

For dynamic keys, it is the keyARN of KEK of the TR-31 wrapped PEK. For ECDH, it is the keyARN of the asymmetric ECC key.

* @public */ IncomingKeyIdentifier: string | undefined; /** *

The keyARN of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK.

+ *

For ECDH, it is the keyARN of the asymmetric ECC key.

* @public */ OutgoingKeyIdentifier: string | undefined; @@ -3519,6 +3634,12 @@ export interface VerifyPinDataInput { * @public */ DukptAttributes?: DukptAttributes; + + /** + *

Parameter information of a WrappedKeyBlock for encryption key exchange.

+ * @public + */ + EncryptionWrappedKey?: WrappedKey; } /** @@ -3751,11 +3872,21 @@ export const EncryptionDecryptionAttributesFilterSensitiveLog = (obj: Encryption if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; }; +/** + * @internal + */ +export const EcdhDerivationAttributesFilterSensitiveLog = (obj: EcdhDerivationAttributes): any => ({ + ...obj, + ...(obj.PublicKeyCertificate && { PublicKeyCertificate: SENSITIVE_STRING }), +}); + /** * @internal */ export const WrappedKeyMaterialFilterSensitiveLog = (obj: WrappedKeyMaterial): any => { if (obj.Tr31KeyBlock !== undefined) return { Tr31KeyBlock: SENSITIVE_STRING }; + if (obj.DiffieHellmanSymmetricKey !== undefined) + return { DiffieHellmanSymmetricKey: EcdhDerivationAttributesFilterSensitiveLog(obj.DiffieHellmanSymmetricKey) }; if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; }; @@ -4019,6 +4150,7 @@ export const GeneratePinDataInputFilterSensitiveLog = (obj: GeneratePinDataInput GenerationAttributes: PinGenerationAttributesFilterSensitiveLog(obj.GenerationAttributes), }), ...(obj.PrimaryAccountNumber && { PrimaryAccountNumber: SENSITIVE_STRING }), + ...(obj.EncryptionWrappedKey && { EncryptionWrappedKey: WrappedKeyFilterSensitiveLog(obj.EncryptionWrappedKey) }), }); /** @@ -4254,4 +4386,5 @@ export const VerifyPinDataInputFilterSensitiveLog = (obj: VerifyPinDataInput): a }), ...(obj.EncryptedPinBlock && { EncryptedPinBlock: SENSITIVE_STRING }), ...(obj.PrimaryAccountNumber && { PrimaryAccountNumber: SENSITIVE_STRING }), + ...(obj.EncryptionWrappedKey && { EncryptionWrappedKey: WrappedKeyFilterSensitiveLog(obj.EncryptionWrappedKey) }), }); diff --git a/clients/client-payment-cryptography-data/src/protocols/Aws_restJson1.ts b/clients/client-payment-cryptography-data/src/protocols/Aws_restJson1.ts index 99ced6800a29..41920afa71bc 100644 --- a/clients/client-payment-cryptography-data/src/protocols/Aws_restJson1.ts +++ b/clients/client-payment-cryptography-data/src/protocols/Aws_restJson1.ts @@ -71,6 +71,7 @@ import { DukptEncryptionAttributes, DynamicCardVerificationCode, DynamicCardVerificationValue, + EcdhDerivationAttributes, Emv2000Attributes, EmvCommonAttributes, EmvEncryptionAttributes, @@ -256,6 +257,7 @@ export const se_GeneratePinDataCommand = async ( body = JSON.stringify( take(input, { EncryptionKeyIdentifier: [], + EncryptionWrappedKey: (_) => _json(_), GenerationAttributes: (_) => _json(_), GenerationKeyIdentifier: [], PinBlockFormat: [], @@ -421,6 +423,7 @@ export const se_VerifyPinDataCommand = async ( DukptAttributes: (_) => _json(_), EncryptedPinBlock: [], EncryptionKeyIdentifier: [], + EncryptionWrappedKey: (_) => _json(_), PinBlockFormat: [], PinDataLength: [], PrimaryAccountNumber: [], @@ -911,6 +914,8 @@ const de_VerificationFailedExceptionRes = async ( // se_DynamicCardVerificationValue omitted. +// se_EcdhDerivationAttributes omitted. + // se_Emv2000Attributes omitted. // se_EmvCommonAttributes omitted. diff --git a/codegen/sdk-codegen/aws-models/payment-cryptography-data.json b/codegen/sdk-codegen/aws-models/payment-cryptography-data.json index 9954bd6c34f2..4c36c2a379ba 100644 --- a/codegen/sdk-codegen/aws-models/payment-cryptography-data.json +++ b/codegen/sdk-codegen/aws-models/payment-cryptography-data.json @@ -324,6 +324,17 @@ "smithy.api#documentation": "

Card data parameters that are required to verify Card Verification Value (CVV2) for the payment card.

" } }, + "com.amazonaws.paymentcryptographydata#CertificateType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 32768 + }, + "smithy.api#pattern": "^[^\\[;\\]<>]+$", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.paymentcryptographydata#CipherTextType": { "type": "string", "traits": { @@ -836,6 +847,56 @@ "smithy.api#documentation": "

Parameters that are required to generate or verify Dynamic Card Verification Value (dCVV).

" } }, + "com.amazonaws.paymentcryptographydata#EcdhDerivationAttributes": { + "type": "structure", + "members": { + "CertificateAuthorityPublicKeyIdentifier": { + "target": "com.amazonaws.paymentcryptographydata#KeyArnOrKeyAliasType", + "traits": { + "smithy.api#documentation": "

The keyArn of the certificate that signed the client's PublicKeyCertificate.

", + "smithy.api#required": {} + } + }, + "PublicKeyCertificate": { + "target": "com.amazonaws.paymentcryptographydata#CertificateType", + "traits": { + "smithy.api#documentation": "

The client's public key certificate in PEM format (base64 encoded) to use for ECDH key derivation.

", + "smithy.api#required": {} + } + }, + "KeyAlgorithm": { + "target": "com.amazonaws.paymentcryptographydata#SymmetricKeyAlgorithm", + "traits": { + "smithy.api#documentation": "

The key algorithm of the derived ECDH key.

", + "smithy.api#required": {} + } + }, + "KeyDerivationFunction": { + "target": "com.amazonaws.paymentcryptographydata#KeyDerivationFunction", + "traits": { + "smithy.api#documentation": "

The key derivation function to use for deriving a key using ECDH.

", + "smithy.api#required": {} + } + }, + "KeyDerivationHashAlgorithm": { + "target": "com.amazonaws.paymentcryptographydata#KeyDerivationHashAlgorithm", + "traits": { + "smithy.api#documentation": "

The hash type to use for deriving a key using ECDH.

", + "smithy.api#required": {} + } + }, + "SharedInformation": { + "target": "com.amazonaws.paymentcryptographydata#SharedInformation", + "traits": { + "smithy.api#documentation": "

A byte string containing information that binds the ECDH derived key to the two parties involved or to the context of the key.

\n

It may include details like identities of the two parties deriving the key, context of the operation, session IDs, and optionally a nonce. It must not contain zero bytes, and re-using shared information for multiple ECDH key derivations is not recommended.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Parameters required to establish ECDH based key exchange.

" + } + }, "com.amazonaws.paymentcryptographydata#Emv2000Attributes": { "type": "structure", "members": { @@ -1582,7 +1643,7 @@ } ], "traits": { - "smithy.api#documentation": "

Generates pin-related data such as PIN, PIN Verification Value (PVV), PIN Block, and PIN Offset during new card issuance or reissuance. For more information, see Generate PIN data in the Amazon Web Services Payment Cryptography User Guide.

\n

PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation generates PIN, PVV, or PIN Offset and then encrypts it using Pin Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. This operation uses a separate Pin Verification Key (PVK) for VISA PVV generation.

\n

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

\n

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

\n

\n Related operations:\n

\n ", + "smithy.api#documentation": "

Generates pin-related data such as PIN, PIN Verification Value (PVV), PIN Block, and PIN Offset during new card issuance or reissuance. For more information, see Generate PIN data in the Amazon Web Services Payment Cryptography User Guide.

\n

PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation generates PIN, PVV, or PIN Offset and then encrypts it using Pin Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography. This operation uses a separate Pin Verification Key (PVK) for VISA PVV generation.

\n

Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block. You can also use it for reveal PIN, wherein the generated PIN block is protected by the ECDH derived key before transmission from Amazon Web Services Payment Cryptography. For more information on establishing ECDH derived keys, see the Generating keys in the Amazon Web Services Payment Cryptography User Guide.

\n

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

\n

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

\n

\n Related operations:\n

\n ", "smithy.api#http": { "method": "POST", "uri": "/pindata/generate", @@ -1603,7 +1664,7 @@ "EncryptionKeyIdentifier": { "target": "com.amazonaws.paymentcryptographydata#KeyArnOrKeyAliasType", "traits": { - "smithy.api#documentation": "

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses to encrypt the PIN Block.

", + "smithy.api#documentation": "

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses to encrypt the PIN Block. For ECDH, it is the keyARN of the asymmetric ECC key.

", "smithy.api#required": {} } }, @@ -1633,6 +1694,9 @@ "smithy.api#documentation": "

The PIN encoding format for pin data generation as specified in ISO 9564. Amazon Web Services Payment Cryptography supports ISO_Format_0 and ISO_Format_3.

\n

The ISO_Format_0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats. It is similar to a VISA-4 PIN block format. It supports a PIN from 4 to 12 digits in length.

\n

The ISO_Format_3 PIN block format is the same as ISO_Format_0 except that the fill digits are random values from 10 to 15.

", "smithy.api#required": {} } + }, + "EncryptionWrappedKey": { + "target": "com.amazonaws.paymentcryptographydata#WrappedKey" } }, "traits": { @@ -1659,7 +1723,7 @@ "EncryptionKeyArn": { "target": "com.amazonaws.paymentcryptographydata#KeyArn", "traits": { - "smithy.api#documentation": "

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for encrypted pin block generation.

", + "smithy.api#documentation": "

The keyARN of the PEK that Amazon Web Services Payment Cryptography uses for encrypted pin block generation. For ECDH, it is the keyARN of the asymmetric ECC key.

", "smithy.api#required": {} } }, @@ -2031,6 +2095,46 @@ ] } }, + "com.amazonaws.paymentcryptographydata#KeyDerivationFunction": { + "type": "enum", + "members": { + "NIST_SP800": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NIST_SP800" + } + }, + "ANSI_X963": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ANSI_X963" + } + } + } + }, + "com.amazonaws.paymentcryptographydata#KeyDerivationHashAlgorithm": { + "type": "enum", + "members": { + "SHA_256": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SHA_256" + } + }, + "SHA_384": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SHA_384" + } + }, + "SHA_512": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SHA_512" + } + } + } + }, "com.amazonaws.paymentcryptographydata#MacAlgorithm": { "type": "enum", "members": { @@ -3069,6 +3173,12 @@ "traits": { "smithy.api#enumValue": "ISO_FORMAT_3" } + }, + "ISO_FORMAT_4": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ISO_FORMAT_4" + } } } }, @@ -3683,6 +3793,16 @@ "smithy.api#documentation": "

Parameters to derive session key for Visa payment card for ARQC verification.

" } }, + "com.amazonaws.paymentcryptographydata#SharedInformation": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 2, + "max": 2048 + }, + "smithy.api#pattern": "^(?:[0-9a-fA-F][0-9a-fA-F])+$" + } + }, "com.amazonaws.paymentcryptographydata#SymmetricEncryptionAttributes": { "type": "structure", "members": { @@ -3710,6 +3830,41 @@ "smithy.api#documentation": "

Parameters requried to encrypt plaintext data using symmetric keys.

" } }, + "com.amazonaws.paymentcryptographydata#SymmetricKeyAlgorithm": { + "type": "enum", + "members": { + "TDES_2KEY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "TDES_2KEY" + } + }, + "TDES_3KEY": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "TDES_3KEY" + } + }, + "AES_128": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AES_128" + } + }, + "AES_192": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AES_192" + } + }, + "AES_256": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AES_256" + } + } + } + }, "com.amazonaws.paymentcryptographydata#ThrottlingException": { "type": "structure", "members": { @@ -3782,7 +3937,7 @@ } ], "traits": { - "smithy.api#documentation": "

Translates encrypted PIN block from and to ISO 9564 formats 0,1,3,4. For more information, see Translate PIN data in the Amazon Web Services Payment Cryptography User Guide.

\n

PIN block translation involves changing the encrytion of PIN block from one encryption key to another encryption key and changing PIN block format from one to another without PIN block data leaving Amazon Web Services Payment Cryptography. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK. Amazon Web Services Payment Cryptography supports TDES and AES key derivation type for DUKPT translations.

\n

This operation also supports dynamic keys, allowing you to pass a dynamic PEK as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To translate PIN block using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide.

\n

The allowed combinations of PIN block format translations are guided by PCI. It is important to note that not all encrypted PIN block formats (example, format 1) require PAN (Primary Account Number) as input. And as such, PIN block format that requires PAN (example, formats 0,3,4) cannot be translated to a format (format 1) that does not require a PAN for generation.

\n

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

\n \n

Amazon Web Services Payment Cryptography currently supports ISO PIN block 4 translation for PIN block built using legacy PAN length. That is, PAN is the right most 12 digits excluding the check digits.

\n
\n

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

\n

\n Related operations:\n

\n ", + "smithy.api#documentation": "

Translates encrypted PIN block from and to ISO 9564 formats 0,1,3,4. For more information, see Translate PIN data in the Amazon Web Services Payment Cryptography User Guide.

\n

PIN block translation involves changing a PIN block from one encryption key to another and optionally change its format. PIN block translation occurs entirely within the HSM boundary and PIN data never enters or leaves Amazon Web Services Payment Cryptography in clear text. The encryption key transformation can be from PEK (Pin Encryption Key) to BDK (Base Derivation Key) for DUKPT or from BDK for DUKPT to PEK.

\n

Amazon Web Services Payment Cryptography also supports use of dynamic keys and ECDH (Elliptic Curve Diffie-Hellman) based key exchange for this operation.

\n

Dynamic keys allow you to pass a PEK as a TR-31 WrappedKeyBlock. They can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To translate PIN block using dynamic keys, the keyARN is the Key Encryption Key (KEK) of the TR-31 wrapped PEK. The incoming wrapped key shall have a key purpose of P0 with a mode of use of B or D. For more information, see Using Dynamic Keys in the Amazon Web Services Payment Cryptography User Guide.

\n

Using ECDH key exchange, you can receive cardholder selectable PINs into Amazon Web Services Payment Cryptography. The ECDH derived key protects the incoming PIN block, which is translated to a PEK encrypted PIN block for use within the service. You can also use ECDH for reveal PIN, wherein the service translates the PIN block from PEK to a ECDH derived encryption key. For more information on establishing ECDH derived keys, see the Generating keys in the Amazon Web Services Payment Cryptography User Guide.

\n

The allowed combinations of PIN block format translations are guided by PCI. It is important to note that not all encrypted PIN block formats (example, format 1) require PAN (Primary Account Number) as input. And as such, PIN block format that requires PAN (example, formats 0,3,4) cannot be translated to a format (format 1) that does not require a PAN for generation.

\n

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

\n \n

Amazon Web Services Payment Cryptography currently supports ISO PIN block 4 translation for PIN block built using legacy PAN length. That is, PAN is the right most 12 digits excluding the check digits.

\n
\n

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

\n

\n Related operations:\n

\n ", "smithy.api#http": { "method": "POST", "uri": "/pindata/translate", @@ -3796,14 +3951,14 @@ "IncomingKeyIdentifier": { "target": "com.amazonaws.paymentcryptographydata#KeyArnOrKeyAliasType", "traits": { - "smithy.api#documentation": "

The keyARN of the encryption key under which incoming PIN block data is encrypted. This key type can be PEK or BDK.

\n

When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key for PIN block. Otherwise, it is the key identifier used to perform the operation.

", + "smithy.api#documentation": "

The keyARN of the encryption key under which incoming PIN block data is encrypted. This key type can be PEK or BDK.

\n

For dynamic keys, it is the keyARN of KEK of the TR-31 wrapped PEK. For ECDH, it is the keyARN of the asymmetric ECC key.

", "smithy.api#required": {} } }, "OutgoingKeyIdentifier": { "target": "com.amazonaws.paymentcryptographydata#KeyArnOrKeyAliasType", "traits": { - "smithy.api#documentation": "

The keyARN of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK.

", + "smithy.api#documentation": "

The keyARN of the encryption key for encrypting outgoing PIN block data. This key type can be PEK or BDK.

\n

For ECDH, it is the keyARN of the asymmetric ECC key.

", "smithy.api#required": {} } }, @@ -4460,6 +4615,9 @@ "traits": { "smithy.api#documentation": "

The attributes and values for the DUKPT encrypted PIN block data.

" } + }, + "EncryptionWrappedKey": { + "target": "com.amazonaws.paymentcryptographydata#WrappedKey" } }, "traits": { @@ -4673,6 +4831,12 @@ "traits": { "smithy.api#documentation": "

The TR-31 wrapped key block.

" } + }, + "DiffieHellmanSymmetricKey": { + "target": "com.amazonaws.paymentcryptographydata#EcdhDerivationAttributes", + "traits": { + "smithy.api#documentation": "

The parameter information for deriving a ECDH shared key.

" + } } }, "traits": {