Skip to content
GitHubXDiscord

Key

The Key resource allows you to manage AWS PaymentCryptography Keys for secure payment processing and cryptographic operations.

Create a basic PaymentCryptography Key with essential properties.

import AWS from "alchemy/aws/control";
const paymentKey = await AWS.PaymentCryptography.Key("basicKey", {
Exportable: false,
KeyAttributes: {
KeyAlgorithm: "SYMMETRIC",
KeyLength: 256
}
});

Configure a PaymentCryptography Key with additional properties such as enabling the key and specifying tags.

const advancedKey = await AWS.PaymentCryptography.Key("advancedKey", {
Exportable: true,
KeyAttributes: {
KeyAlgorithm: "SYMMETRIC",
KeyLength: 256,
KeyUsage: "ENCRYPT_DECRYPT"
},
Enabled: true,
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Project", Value: "PaymentGateway" }
]
});

Create a PaymentCryptography Key that specifies derive key usage for key management.

const deriveKeyUsageKey = await AWS.PaymentCryptography.Key("deriveKeyUsageKey", {
Exportable: false,
KeyAttributes: {
KeyAlgorithm: "SYMMETRIC",
KeyLength: 256
},
DeriveKeyUsage: "DERIVE_KEY"
});

Define a PaymentCryptography Key that includes a key check value algorithm for enhanced security.

const checkValueAlgorithmKey = await AWS.PaymentCryptography.Key("checkValueAlgorithmKey", {
Exportable: true,
KeyAttributes: {
KeyAlgorithm: "SYMMETRIC",
KeyLength: 256
},
KeyCheckValueAlgorithm: "SHA256",
Enabled: true
});