AWS Cryptography Internal Primitives

1.11.2 · active · verified Thu Apr 16

This library contains internal primitives used by higher-level AWS Cryptography libraries, such as the AWS Encryption SDK. It is *not intended for direct public consumption* and is explicitly marked for internal use only by AWS. Direct usage is strongly discouraged due to potential breaking changes without notice. The current version is 1.11.2, and it is actively maintained with irregular releases driven by upstream AWS Cryptography library requirements.

Common errors

Warnings

Install

Imports

Quickstart

This code demonstrates the creation of an internal `SymmetricCryptoKey` object for illustrative purposes only. *This library is strictly for internal AWS use* and not intended for direct customer consumption. Direct use of these primitives is strongly discouraged as the API is unstable, subject to breaking changes without notice, and does not offer the security and usability guarantees of higher-level AWS Cryptography SDKs (e.g., AWS Encryption SDK or AWS KMS Client). Do NOT use this code in production.

# WARNING: This library is for internal AWS use only and NOT intended for direct consumption.
# The following code is for illustrative purposes only and should NOT be used in production.
# Expect breaking changes without notice if you use this directly.
import os
from aws_cryptography_internal_primitives.keys import SymmetricCryptoKey, KeyType, KeyLength

# This example demonstrates creating a SymmetricCryptoKey, an internal primitive.
# Direct use is discouraged due to internal design and lack of stability guarantees.
raw_aes_key = os.urandom(32) # 256-bit AES key

# Create an internal symmetric key object
internal_aes_key = SymmetricCryptoKey(
    material=raw_aes_key,
    key_type=KeyType.SYMMETRIC,
    key_length=KeyLength.AES_256
)

print(f"Internal Key Type: {internal_aes_key.key_type.name}")
print(f"Internal Key Length: {internal_aes_key.key_length.value} bits")
print(f"Key material is present: {internal_aes_key.material is not None}")
# DO NOT print or expose raw key material in real applications!

view raw JSON →