AWS Cryptography Internal Standard Library
The `aws-cryptography-internal-standard-library` is an internal Python library, a foundational component primarily utilized by the AWS Cryptographic Material Providers Library (MPL) and subsequently by the AWS Encryption SDK. It provides cryptographic primitives and standard library interfaces for other AWS cryptography projects. Users are strongly advised against taking a standalone dependency on this library, as its internal nature means there are no guarantees about API stability or functionality between minor versions. The current version is 1.11.2, and its release cadence aligns with its dependent AWS cryptography libraries.
Common errors
-
ModuleNotFoundError: No module named 'aws_cryptography_internal_standard_library.some_internal_module'
cause Attempting to import an internal module or symbol that either does not exist, has been renamed, or is not exposed via a public API.fixThis library is not designed for direct imports. If you need cryptographic functionality, use a higher-level AWS cryptography library such as `aws-encryption-sdk` and follow its documented import paths and usage patterns. -
AttributeError: module 'aws_cryptography_internal_standard_library' has no attribute 'some_function'
cause Trying to access a non-existent function or a function that is internal and not part of any stable public interface.fixThis indicates an attempt to interact with the library in an unsupported way. You should only use officially documented public APIs provided by client-side encryption libraries like the AWS Encryption SDK.
Warnings
- breaking Do NOT take a standalone dependency on this library. It is an internal component, and AWS makes no guarantees that its functionality or API will remain stable or consistent between minor versions. Direct usage can lead to unexpected breakages in your application.
- gotcha Lack of direct documentation and examples. Since this library is internal, there is no dedicated public documentation or usage examples for direct interaction. Relying on reverse-engineering or undocumented internal APIs is highly discouraged.
- gotcha Python compatibility is dictated by its consumers. While PyPI lists `<4.0.0,>=3.11.0`, the effective minimum Python version might be higher or lower depending on the specific versions of the consuming AWS cryptography libraries (e.g., `aws-encryption-sdk`).
Install
-
pip install aws-cryptography-internal-standard-library -
pip install "aws-encryption-sdk[MPL]"
Imports
- aws_cryptography_internal_standard_library
# No public API for direct import. This library is an internal dependency.
Quickstart
print('The aws-cryptography-internal-standard-library is an internal dependency.')
print('Direct interaction is not recommended as its API is unstable and not for public use.')
print('Instead, use public-facing libraries like the AWS Encryption SDK (aws-encryption-sdk).')
# Example of how you would typically interact with encryption functionality
# through the AWS Encryption SDK, which internally uses libraries like this one.
# This code snippet is for illustration and requires additional setup (AWS credentials, KMS key).
# import aws_encryption_sdk
# from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
# key_arn = os.environ.get('KMS_KEY_ARN', 'arn:aws:kms:us-west-2:111122223333:key/example-key-id')
# plaintext = b'my secret data'
# try:
# # Instantiate the AWS Encryption SDK client
# client = aws_encryption_sdk.EncryptionSDKClient()
# # Create a KMS Keyring (this uses the AWS Cryptographic Material Providers Library internally)
# keyring = AwsKmsKeyring(key_ids=[key_arn])
# # Encrypt the data
# ciphertext, header = client.encrypt(source=plaintext, keyring=keyring)
# print(f'Ciphertext: {ciphertext.hex()}')
# # Decrypt the data
# decrypted_plaintext, _ = client.decrypt(source=ciphertext, keyring=keyring)
# print(f'Decrypted plaintext: {decrypted_plaintext.decode()}')
# except Exception as e:
# print(f'Error demonstrating AWS Encryption SDK: {e}')
# print('Please ensure AWS credentials and a valid KMS_KEY_ARN are configured.')