Export Key
| paymentcryptographycontrolplane_export_key | R Documentation |
Exports a key from Amazon Web Services Payment Cryptography¶
Description¶
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 export_key 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, RSA unwrap, and ECDH (Elliptic Curve Diffie-Hellman) 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). After which you can export working keys using symmetric method to perform various cryptographic operations within Amazon Web Services Payment Cryptography.
PCI requires specific minimum key strength of wrapping keys used to protect the keys being exchanged electronically. These requirements can change when PCI standards are revised. The rules specify that wrapping keys used for transport must be at least as strong as the key being protected. For more information on recommended key strength of wrapping keys and key exchange mechanism, see Importing and exporting keys in the Amazon Web Services Payment Cryptography User Guide.
You can also use export_key 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.
For key exchange using TR-31 or TR-34 key blocks, you can also export
optional blocks within the key block header which contain additional
attribute information about the key. The KeyVersion within
KeyBlockHeaders indicates the version of the key within the key block.
Furthermore, KeyExportability within KeyBlockHeaders can be used to
further restrict exportability of the key after export from Amazon Web
Services Payment Cryptography.
The OptionalBlocks contain the additional data related to the key. For
information on data type that can be included within optional blocks,
refer to ASC X9.143-2022.
Data included in key block headers is signed but transmitted in clear text. Sensitive or confidential information should not be included in optional blocks. Refer to ASC X9.143-2022 standard for information on allowed data type.
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 get_parameters_for_export. 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 30 days.
Next the KRD generates a key pair for the the purpose of encrypting the
KDH key and provides the public key cerificate (also known as KRD
wrapping certificate) back to KDH. The KRD will also import the root
cerificate chain into Amazon Web Services Payment Cryptography by
calling import_key for RootCertificatePublicKey. The KDH, Amazon Web
Services Payment Cryptography, will use the KRD wrapping cerificate to
encrypt (wrap) the key under export and signs it with signing private
key to generate a TR-34 WrappedKeyBlock. For more information on TR-34
key export, see section Exporting symmetric
keys
in the Amazon Web Services Payment Cryptography User Guide.
Set the following parameters:
-
ExportAttributes: Specify export attributes in case of IPEK export. This parameter is optional for KEK export. -
ExportKeyIdentifier: TheKeyARNof the KEK or BDK (in case of IPEK) under export. -
KeyMaterial: UseTr34KeyBlockparameters. -
CertificateAuthorityPublicKeyIdentifier: TheKeyARNof the certificate chain that signed the KRD wrapping key certificate. -
ExportToken: Obtained from KDH by callingget_parameters_for_import. -
WrappingKeyCertificate: The public key certificate in PEM format (base64 encoded) of the KRD wrapping key Amazon Web Services Payment Cryptography uses for encryption of the TR-34 export payload. This certificate must be signed by the root certificate (CertificateAuthorityPublicKeyIdentifier) imported into Amazon Web Services Payment Cryptography.
When this operation is successful, Amazon Web Services Payment Cryptography returns the KEK or IPEK as a TR-34 WrappedKeyBlock.
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 import_key for
RootCertificatePublicKey.
Next call export_key and set the following parameters:
-
CertificateAuthorityPublicKeyIdentifier: TheKeyARNof the certificate chain that signed wrapping key certificate. -
KeyMaterial: Set toKeyCryptogram. -
WrappingKeyCertificate: 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.
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 create_key or import_key.
Set the following parameters:
-
ExportAttributes: Specify export attributes in case of IPEK export. This parameter is optional for KEK export. -
ExportKeyIdentifier: TheKeyARNof the KEK or BDK (in case of IPEK) under export. -
KeyMaterial: UseTr31KeyBlockparameters.
To export working keys using ECDH
You can also use ECDH key agreement to export working keys in a TR-31 keyblock, where the wrapping key is an ECDH derived key.
To initiate a TR-31 key export using ECDH, both sides must create an ECC
key pair with key usage K3 and exchange public key certificates. In
Amazon Web Services Payment Cryptography, you can do this by calling
create_key. If you have not already done so, you must import the CA
chain that issued the receiving public key certificate by calling
import_key with input RootCertificatePublicKey for root CA or
TrustedPublicKey for intermediate CA. You can then complete a TR-31
key export by deriving a shared wrapping key using the service ECC key
pair, public certificate of your ECC key pair outside of Amazon Web
Services Payment Cryptography, and the key derivation parameters
including key derivation function, hash algorithm, derivation data, key
algorithm.
-
KeyMaterial: UseDiffieHellmanTr31KeyBlockparameters. -
PrivateKeyIdentifier: TheKeyArnof the ECC key pair created within Amazon Web Services Payment Cryptography to derive a shared KEK. -
PublicKeyCertificate: The public key certificate of the receiving ECC key pair in PEM format (base64 encoded) to derive a shared KEK. -
CertificateAuthorityPublicKeyIdentifier: ThekeyARNof the CA that signed the public key certificate of the receiving ECC key pair.
When this operation is successful, Amazon Web Services Payment Cryptography returns the working key as a TR-31 WrappedKeyBlock, where the wrapping key is the ECDH derived key.
Cross-account use: This operation supports cross-account use when the key has a resource-based policy that grants access. For more information, see Resource-based policies.
Related operations:
-
get_parameters_for_export -
import_key
Usage¶
paymentcryptographycontrolplane_export_key(KeyMaterial,
ExportKeyIdentifier, ExportAttributes)
Arguments¶
KeyMaterial |
[required] The key block format type, for example, TR-34 or TR-31, to use during key material export. |
ExportKeyIdentifier |
[required] The |
ExportAttributes |
The attributes for IPEK generation during export. |
Value¶
A list with the following syntax:
list(
WrappedKey = list(
WrappingKeyArn = "string",
WrappedKeyMaterialFormat = "KEY_CRYPTOGRAM"|"TR31_KEY_BLOCK"|"TR34_KEY_BLOCK",
KeyMaterial = "string",
KeyCheckValue = "string",
KeyCheckValueAlgorithm = "CMAC"|"ANSI_X9_24"|"HMAC"|"SHA_1"
)
)
Request syntax¶
svc$export_key(
KeyMaterial = list(
Tr31KeyBlock = list(
WrappingKeyIdentifier = "string",
KeyBlockHeaders = list(
KeyModesOfUse = list(
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
),
KeyExportability = "EXPORTABLE"|"NON_EXPORTABLE"|"SENSITIVE",
KeyVersion = "string",
OptionalBlocks = list(
"string"
)
)
),
Tr34KeyBlock = list(
CertificateAuthorityPublicKeyIdentifier = "string",
WrappingKeyCertificate = "string",
ExportToken = "string",
SigningKeyIdentifier = "string",
SigningKeyCertificate = "string",
KeyBlockFormat = "X9_TR34_2012",
RandomNonce = "string",
KeyBlockHeaders = list(
KeyModesOfUse = list(
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
),
KeyExportability = "EXPORTABLE"|"NON_EXPORTABLE"|"SENSITIVE",
KeyVersion = "string",
OptionalBlocks = list(
"string"
)
)
),
KeyCryptogram = list(
CertificateAuthorityPublicKeyIdentifier = "string",
WrappingKeyCertificate = "string",
WrappingSpec = "RSA_OAEP_SHA_256"|"RSA_OAEP_SHA_512"
),
DiffieHellmanTr31KeyBlock = list(
PrivateKeyIdentifier = "string",
CertificateAuthorityPublicKeyIdentifier = "string",
PublicKeyCertificate = "string",
DeriveKeyAlgorithm = "TDES_2KEY"|"TDES_3KEY"|"AES_128"|"AES_192"|"AES_256"|"HMAC_SHA256"|"HMAC_SHA384"|"HMAC_SHA512"|"HMAC_SHA224",
KeyDerivationFunction = "NIST_SP800"|"ANSI_X963",
KeyDerivationHashAlgorithm = "SHA_256"|"SHA_384"|"SHA_512",
DerivationData = list(
SharedInformation = "string"
),
KeyBlockHeaders = list(
KeyModesOfUse = list(
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
),
KeyExportability = "EXPORTABLE"|"NON_EXPORTABLE"|"SENSITIVE",
KeyVersion = "string",
OptionalBlocks = list(
"string"
)
)
),
As2805KeyCryptogram = list(
WrappingKeyIdentifier = "string",
As2805KeyVariant = "TERMINAL_MAJOR_KEY_VARIANT_00"|"PIN_ENCRYPTION_KEY_VARIANT_28"|"MESSAGE_AUTHENTICATION_KEY_VARIANT_24"|"DATA_ENCRYPTION_KEY_VARIANT_22"
)
),
ExportKeyIdentifier = "string",
ExportAttributes = list(
ExportDukptInitialKey = list(
KeySerialNumber = "string"
),
KeyCheckValueAlgorithm = "CMAC"|"ANSI_X9_24"|"HMAC"|"SHA_1"
)
)