pub struct ExportKeyFluentBuilder { /* private fields */ }
Expand description
Fluent builder constructing a request to ExportKey
.
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, 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 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.
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 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 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 ImportKey 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
: TheKeyARN
of the KEK or BDK (in case of IPEK) under export. -
KeyMaterial
: UseTr34KeyBlock
parameters. -
CertificateAuthorityPublicKeyIdentifier
: TheKeyARN
of the certificate chain that signed the KRD wrapping key certificate. -
ExportToken
: Obtained from KDH by calling GetParametersForImport. -
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 ImportKey for RootCertificatePublicKey
.
Next call ExportKey
and set the following parameters:
-
CertificateAuthorityPublicKeyIdentifier
: TheKeyARN
of 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 CreateKey or ImportKey.
Set the following parameters:
-
ExportAttributes
: Specify export attributes in case of IPEK export. This parameter is optional for KEK export. -
ExportKeyIdentifier
: TheKeyARN
of the KEK or BDK (in case of IPEK) under export. -
KeyMaterial
: UseTr31KeyBlock
parameters.
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 CreateKey
. If you have not already done so, you must import the CA chain that issued the receiving public key certificate by calling ImportKey
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
: UseDiffieHellmanTr31KeyBlock
parameters. -
PrivateKeyIdentifier
: TheKeyArn
of 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
: ThekeyARN
of 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 can't be used across different Amazon Web Services accounts.
Related operations:
Implementations§
Source§impl ExportKeyFluentBuilder
impl ExportKeyFluentBuilder
Sourcepub fn as_input(&self) -> &ExportKeyInputBuilder
pub fn as_input(&self) -> &ExportKeyInputBuilder
Access the ExportKey as a reference.
Sourcepub async fn send(
self,
) -> Result<ExportKeyOutput, SdkError<ExportKeyError, HttpResponse>>
pub async fn send( self, ) -> Result<ExportKeyOutput, SdkError<ExportKeyError, HttpResponse>>
Sends the request and returns the response.
If an error occurs, an SdkError
will be returned with additional details that
can be matched against.
By default, any retryable failures will be retried twice. Retry behavior is configurable with the RetryConfig, which can be set when configuring the client.
Sourcepub fn customize(
self,
) -> CustomizableOperation<ExportKeyOutput, ExportKeyError, Self>
pub fn customize( self, ) -> CustomizableOperation<ExportKeyOutput, ExportKeyError, Self>
Consumes this builder, creating a customizable operation that can be modified before being sent.
Sourcepub fn key_material(self, input: ExportKeyMaterial) -> Self
pub fn key_material(self, input: ExportKeyMaterial) -> Self
The key block format type, for example, TR-34 or TR-31, to use during key material export.
Sourcepub fn set_key_material(self, input: Option<ExportKeyMaterial>) -> Self
pub fn set_key_material(self, input: Option<ExportKeyMaterial>) -> Self
The key block format type, for example, TR-34 or TR-31, to use during key material export.
Sourcepub fn get_key_material(&self) -> &Option<ExportKeyMaterial>
pub fn get_key_material(&self) -> &Option<ExportKeyMaterial>
The key block format type, for example, TR-34 or TR-31, to use during key material export.
Sourcepub fn export_key_identifier(self, input: impl Into<String>) -> Self
pub fn export_key_identifier(self, input: impl Into<String>) -> Self
The KeyARN
of the key under export from Amazon Web Services Payment Cryptography.
Sourcepub fn set_export_key_identifier(self, input: Option<String>) -> Self
pub fn set_export_key_identifier(self, input: Option<String>) -> Self
The KeyARN
of the key under export from Amazon Web Services Payment Cryptography.
Sourcepub fn get_export_key_identifier(&self) -> &Option<String>
pub fn get_export_key_identifier(&self) -> &Option<String>
The KeyARN
of the key under export from Amazon Web Services Payment Cryptography.
Sourcepub fn export_attributes(self, input: ExportAttributes) -> Self
pub fn export_attributes(self, input: ExportAttributes) -> Self
The attributes for IPEK generation during export.
Sourcepub fn set_export_attributes(self, input: Option<ExportAttributes>) -> Self
pub fn set_export_attributes(self, input: Option<ExportAttributes>) -> Self
The attributes for IPEK generation during export.
Sourcepub fn get_export_attributes(&self) -> &Option<ExportAttributes>
pub fn get_export_attributes(&self) -> &Option<ExportAttributes>
The attributes for IPEK generation during export.
Trait Implementations§
Source§impl Clone for ExportKeyFluentBuilder
impl Clone for ExportKeyFluentBuilder
Source§fn clone(&self) -> ExportKeyFluentBuilder
fn clone(&self) -> ExportKeyFluentBuilder
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ExportKeyFluentBuilder
impl !RefUnwindSafe for ExportKeyFluentBuilder
impl Send for ExportKeyFluentBuilder
impl Sync for ExportKeyFluentBuilder
impl Unpin for ExportKeyFluentBuilder
impl !UnwindSafe for ExportKeyFluentBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);