Skip to content

Commit

Permalink
feat(client-payment-cryptography): Provide an additional option for k…
Browse files Browse the repository at this point in the history
…ey 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.
  • Loading branch information
awstools committed Jan 16, 2024
1 parent 6e2b19f commit f7acac4
Show file tree
Hide file tree
Showing 6 changed files with 322 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare
* @public
* <p>Exports a key from Amazon Web Services Payment Cryptography.</p>
* <p>Amazon Web Services Payment Cryptography simplifies key exchange by replacing the existing paper-based approach with a modern electronic approach. With <code>ExportKey</code> 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 </p>
* <p>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.</p>
* <p>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.</p>
* <p>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.</p>
* <p>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. </p>
* <p>You can also use <code>ExportKey</code> 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 <code>ExportDukptInitialKey</code> attribute KSN (<code>KeySerialNumber</code>). The generated IPEK does not persist within Amazon Web Services Payment Cryptography and has to be re-generated each time during export.</p>
* <p>
* <b>To export KEK or IPEK using TR-34</b>
* <b>To export initial keys (KEK) or IPEK using TR-34</b>
* </p>
* <p>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.</p>
* <p>To initiate TR-34 key export, the KRD must obtain an export token by calling <a>GetParametersForExport</a>. 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. </p>
Expand Down Expand Up @@ -77,7 +77,27 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare
* </ul>
* <p>When this operation is successful, Amazon Web Services Payment Cryptography returns the KEK or IPEK as a TR-34 WrappedKeyBlock. </p>
* <p>
* <b>To export WK (Working Key) or IPEK using TR-31</b>
* <b>To export initial keys (KEK) or IPEK using RSA Wrap and Unwrap</b>
* </p>
* <p>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 <a>ImportKey</a> for <code>RootCertificatePublicKey</code>.</p>
* <p>Next call <code>ExportKey</code> and set the following parameters:</p>
* <ul>
* <li>
* <p>
* <code>CertificateAuthorityPublicKeyIdentifier</code>: The <code>KeyARN</code> of the certificate chain that signed wrapping key certificate.</p>
* </li>
* <li>
* <p>
* <code>KeyMaterial</code>: Set to <code>KeyCryptogram</code>.</p>
* </li>
* <li>
* <p>
* <code>WrappingKeyCertificate</code>: The public key certificate in PEM format (base64 encoded) obtained by the receiving HSM and signed by the root certificate (CertificateAuthorityPublicKeyIdentifier) imported into Amazon Web Services Payment Cryptography. The receiving HSM uses its private key component to unwrap the WrappedKeyCryptogram.</p>
* </li>
* </ul>
* <p>When this operation is successful, Amazon Web Services Payment Cryptography returns the WrappedKeyCryptogram. </p>
* <p>
* <b>To export working keys or IPEK using TR-31</b>
* </p>
* <p>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 <a>CreateKey</a> or <a>ImportKey</a>. </p>
* <p>Set the following parameters:</p>
Expand All @@ -95,7 +115,7 @@ export interface ExportKeyCommandOutput extends ExportKeyOutput, __MetadataBeare
* <code>KeyMaterial</code>: Use <code>Tr31KeyBlock</code> parameters.</p>
* </li>
* </ul>
* <p>When this operation is successful, Amazon Web Services Payment Cryptography returns the WK or IPEK as a TR-31 WrappedKeyBlock.</p>
* <p>When this operation is successful, Amazon Web Services Payment Cryptography returns the working key or IPEK as a TR-31 WrappedKeyBlock.</p>
* <p>
* <b>Cross-account use:</b> This operation can't be used across different Amazon Web Services accounts.</p>
* <p>
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface GetParametersForImportCommandOutput extends GetParametersForImp

/**
* @public
* <p>Gets the import token and the wrapping key certificate in PEM format (base64 encoded) to initiate a TR-34 WrappedKeyBlock.</p>
* <p>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.</p>
* <p>The wrapping key certificate wraps the key under import. The import token and wrapping key certificate must be in place and operational before calling <a>ImportKey</a>. The import token expires in 7 days. You can use the same import token to import multiple keys into your service account.</p>
* <p>
* <b>Cross-account use:</b> This operation can't be used across different Amazon Web Services accounts.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare
* @public
* <p>Imports symmetric keys and public key certificates in PEM format (base64 encoded) into Amazon Web Services Payment Cryptography.</p>
* <p>Amazon Web Services Payment Cryptography simplifies key exchange by replacing the existing paper-based approach with a modern electronic approach. With <code>ImportKey</code> you can import symmetric keys using either symmetric and asymmetric key exchange mechanisms.</p>
* <p>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.</p>
* <p>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. </p>
* <p>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.</p>
* <p>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. </p>
* <p>You can also import a <i>root public key certificate</i>, used to sign other public key certificates, or a <i>trusted public key certificate</i> under an already established root public key certificate.</p>
* <p>
* <b>To import a public root key certificate</b>
Expand Down Expand Up @@ -96,7 +96,7 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare
* </li>
* </ul>
* <p>
* <b>To import KEK or ZMK using TR-34</b>
* <b>To import initial keys (KEK or ZMK or similar) using TR-34</b>
* </p>
* <p>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.</p>
* <p>To initiate TR-34 key import, the KDH must obtain an import token by calling <a>GetParametersForImport</a>. 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.</p>
Expand Down Expand Up @@ -125,7 +125,12 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare
* </li>
* </ul>
* <p>
* <b>To import WK (Working Key) using TR-31</b>
* <b>To import initial keys (KEK or ZMK or similar) using RSA Wrap and Unwrap</b>
* </p>
* <p>Using this operation, you can import initial key using asymmetric RSA wrap and unwrap key exchange method. To initiate import, call <a>GetParametersForImport</a> with <code>KeyMaterial</code> set to <code>KEY_CRYPTOGRAM</code> 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. </p>
* <p>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 <code>ImportKey</code> with <code>KeyMaterial</code> set to <code>KEY_CRYPTOGRAM</code> and provide the <code>ImportToken</code> and <code>KeyAttributes</code> for the key under import.</p>
* <p>
* <b>To import working keys using TR-31</b>
* </p>
* <p>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 <a>CreateKey</a>. To initiate a TR-31 key import, set the following parameters:</p>
* <ul>
Expand Down Expand Up @@ -218,6 +223,28 @@ export interface ImportKeyCommandOutput extends ImportKeyOutput, __MetadataBeare
* KeyBlockFormat: "STRING_VALUE", // required
* RandomNonce: "STRING_VALUE",
* },
* KeyCryptogram: { // ImportKeyCryptogram
* KeyAttributes: {
* KeyUsage: "STRING_VALUE", // required
* KeyClass: "STRING_VALUE", // required
* KeyAlgorithm: "STRING_VALUE", // required
* KeyModesOfUse: {
* Encrypt: true || false,
* Decrypt: true || false,
* Wrap: true || false,
* Unwrap: true || false,
* Generate: true || false,
* Sign: true || false,
* Verify: true || false,
* DeriveKey: true || false,
* NoRestrictions: true || false,
* },
* },
* Exportable: true || false, // required
* WrappedKeyCryptogram: "STRING_VALUE", // required
* ImportToken: "STRING_VALUE", // required
* WrappingSpec: "STRING_VALUE",
* },
* },
* KeyCheckValueAlgorithm: "STRING_VALUE",
* Enabled: true || false,
Expand Down

0 comments on commit f7acac4

Please sign in to comment.