From d03ab279b8006f5f9056fc1519936ad695e10a4a Mon Sep 17 00:00:00 2001 From: Ritvik Kapila <61410899+RitvikKapila@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:22:19 -0800 Subject: [PATCH] chore(rust): clean-up lib.rs (#725) --- AwsEncryptionSDK/runtimes/rust/README.md | 2 +- .../client_supplier_example.rs | 8 +- .../regional_role_client_supplier.rs | 6 +- .../required_encryption_context_example.rs | 4 +- .../signing_only_example.rs | 8 +- .../signing_suite_only_cmm.rs | 24 +++--- .../aws_kms_discovery_keyring_example.rs | 6 +- ...aws_kms_discovery_multi_keyring_example.rs | 6 +- .../aws_kms_hierarchical_keyring_example.rs | 10 +-- .../create_branch_key_id.rs | 6 +- .../example_branch_key_id_supplier.rs | 8 +- ...he_across_hierarchical_keyrings_example.rs | 16 ++-- .../version_branch_key_id_example.rs | 6 +- .../keyring/aws_kms_keyring_example.rs | 4 +- .../aws_kms_mrk_discovery_keyring_example.rs | 6 +- ...kms_mrk_discovery_multi_keyring_example.rs | 6 +- .../keyring/aws_kms_mrk_keyring_example.rs | 4 +- .../aws_kms_mrk_multi_keyring_example.rs | 4 +- .../keyring/aws_kms_multi_keyring_example.rs | 4 +- .../keyring/aws_kms_rsa_keyring_example.rs | 6 +- .../ephemeral_raw_ecdh_keyring_example.rs | 8 +- .../kms_ecdh_discovery_keyring_example.rs | 10 +-- .../keyring/ecdh/kms_ecdh_keyring_example.rs | 8 +- ..._key_discovery_raw_ecdh_keyring_example.rs | 10 +-- .../keyring/ecdh/raw_ecdh_keyring_example.rs | 8 +- .../examples/keyring/multi_keyring_example.rs | 6 +- .../keyring/raw_aes_keyring_example.rs | 6 +- .../keyring/raw_rsa_keyring_example.rs | 6 +- .../limit_encrypted_data_keys_example.rs | 8 +- .../examples/set_commitment_policy_example.rs | 6 +- .../set_encryption_algorithm_suite_example.rs | 8 +- AwsEncryptionSDK/runtimes/rust/src/lib.rs | 86 +++++++++++++++++-- 32 files changed, 191 insertions(+), 123 deletions(-) diff --git a/AwsEncryptionSDK/runtimes/rust/README.md b/AwsEncryptionSDK/runtimes/rust/README.md index 612c2cac5..b3436b54e 100644 --- a/AwsEncryptionSDK/runtimes/rust/README.md +++ b/AwsEncryptionSDK/runtimes/rust/README.md @@ -17,7 +17,7 @@ For more details about the design and architecture of the AWS Encryption SDK, se ## Examples for AWS Encryption SDK in Rust -Please look at the Examples on how to use the Encryption SDK in Rust [here](https://github.com/aws/aws-encryption-sdk-dafny/tree/mainline/AwsEncryptionSDK/runtimes/rust/examples). +Please look at the Examples on how to use the Encryption SDK in Rust [here](https://github.com/aws/aws-encryption-sdk-dafny/tree/mainline/releases/rust/esdk/examples). Please note that some examples MAY require internet access and valid AWS credentials, since calls to KMS are made. diff --git a/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/client_supplier_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/client_supplier_example.rs index 79a4a1177..c09bcc229 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/client_supplier_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/client_supplier_example.rs @@ -18,10 +18,10 @@ use super::regional_role_client_supplier::RegionalRoleClientSupplier; use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::types::error::Error::AwsCryptographicMaterialProvidersException; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter; +use aws_esdk::material_providers::types::error::Error::AwsCryptographicMaterialProvidersException; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::DiscoveryFilter; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_keyring( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/regional_role_client_supplier.rs b/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/regional_role_client_supplier.rs index 0a6b31a1a..195dd8bb5 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/regional_role_client_supplier.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/client_supplier/regional_role_client_supplier.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use aws_config::Region; -use aws_esdk::aws_cryptography_materialProviders::types::ClientSupplier; -use aws_esdk::aws_cryptography_materialProviders::operation::get_client::GetClientInput; -use aws_esdk::aws_cryptography_materialProviders::types::error::Error; +use aws_esdk::material_providers::types::ClientSupplier; +use aws_esdk::material_providers::operation::get_client::GetClientInput; +use aws_esdk::material_providers::types::error::Error; use aws_esdk::com_amazonaws_kms::client::Client as kms_client; use super::regional_role_client_supplier_config; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/required_encryption_context/required_encryption_context_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/required_encryption_context/required_encryption_context_example.rs index 55e38e76c..bb03bdcbc 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/required_encryption_context/required_encryption_context_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/required_encryption_context/required_encryption_context_example.rs @@ -10,8 +10,8 @@ On decrypt, the client MUST supply the key/value pair(s) that were not stored to use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError; use std::collections::HashMap; use std::vec::Vec; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_only_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_only_example.rs index ea883137a..e8e599eb9 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_only_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_only_example.rs @@ -10,10 +10,10 @@ use super::signing_suite_only_cmm::SigningSuiteOnlyCMM; use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef; -use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef; +use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_cmm( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_suite_only_cmm.rs b/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_suite_only_cmm.rs index 0e1ba8354..cd1481157 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_suite_only_cmm.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/cryptographic_materials_manager/restrict_algorithm_suite/signing_suite_only_cmm.rs @@ -1,18 +1,18 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -use aws_esdk::aws_cryptography_materialProviders::operation::get_encryption_materials::GetEncryptionMaterialsInput; -use aws_esdk::aws_cryptography_materialProviders::operation::get_encryption_materials::GetEncryptionMaterialsOutput; -use aws_esdk::aws_cryptography_materialProviders::operation::decrypt_materials::DecryptMaterialsInput; -use aws_esdk::aws_cryptography_materialProviders::operation::decrypt_materials::DecryptMaterialsOutput; -use aws_esdk::aws_cryptography_materialProviders::types::error::Error; -use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManager; -use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef; -use aws_esdk::aws_cryptography_materialProviders::types::keyring::KeyringRef; -use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId; -use aws_esdk::aws_cryptography_materialProviders::types::AlgorithmSuiteId; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::operation::get_encryption_materials::GetEncryptionMaterialsInput; +use aws_esdk::material_providers::operation::get_encryption_materials::GetEncryptionMaterialsOutput; +use aws_esdk::material_providers::operation::decrypt_materials::DecryptMaterialsInput; +use aws_esdk::material_providers::operation::decrypt_materials::DecryptMaterialsOutput; +use aws_esdk::material_providers::types::error::Error; +use aws_esdk::material_providers::types::cryptographic_materials_manager::CryptographicMaterialsManager; +use aws_esdk::material_providers::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef; +use aws_esdk::material_providers::types::keyring::KeyringRef; +use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId; +use aws_esdk::material_providers::types::AlgorithmSuiteId; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::vec::Vec; /* diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_keyring_example.rs index 7bc096e0b..c38479ca4 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_keyring_example.rs @@ -38,9 +38,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::DiscoveryFilter; use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError; use std::collections::HashMap; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_multi_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_multi_keyring_example.rs index 0773503b1..743ad60bf 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_multi_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_discovery_multi_keyring_example.rs @@ -35,9 +35,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::DiscoveryFilter; use std::collections::HashMap; use std::vec::Vec; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/aws_kms_hierarchical_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/aws_kms_hierarchical_keyring_example.rs index 9aee84897..f0132f6c8 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/aws_kms_hierarchical_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/aws_kms_hierarchical_keyring_example.rs @@ -42,11 +42,11 @@ use super::example_branch_key_id_supplier::ExampleBranchKeyIdSupplier; use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError; -use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration; -use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig; -use aws_esdk::aws_cryptography_keyStore::client as keystore_client; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::key_store::types::KmsConfiguration; +use aws_esdk::key_store::types::key_store_config::KeyStoreConfig; +use aws_esdk::key_store::client as keystore_client; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_keyring( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/create_branch_key_id.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/create_branch_key_id.rs index 6c567c969..bd8bce26b 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/create_branch_key_id.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/create_branch_key_id.rs @@ -1,9 +1,9 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -use aws_esdk::aws_cryptography_keyStore::client as keystore_client; -use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig; -use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration; +use aws_esdk::key_store::client as keystore_client; +use aws_esdk::key_store::types::key_store_config::KeyStoreConfig; +use aws_esdk::key_store::types::KmsConfiguration; /* The Hierarchical Keyring Example relies on the existence diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/example_branch_key_id_supplier.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/example_branch_key_id_supplier.rs index 00255941d..fb7ec8ccb 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/example_branch_key_id_supplier.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/example_branch_key_id_supplier.rs @@ -1,10 +1,10 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -use aws_esdk::aws_cryptography_materialProviders::operation::get_branch_key_id::GetBranchKeyIdInput; -use aws_esdk::aws_cryptography_materialProviders::operation::get_branch_key_id::GetBranchKeyIdOutput; -use aws_esdk::aws_cryptography_materialProviders::types::error::Error; -use aws_esdk::aws_cryptography_materialProviders::types::branch_key_id_supplier::BranchKeyIdSupplier; +use aws_esdk::material_providers::operation::get_branch_key_id::GetBranchKeyIdInput; +use aws_esdk::material_providers::operation::get_branch_key_id::GetBranchKeyIdOutput; +use aws_esdk::material_providers::types::error::Error; +use aws_esdk::material_providers::types::branch_key_id_supplier::BranchKeyIdSupplier; use std::collections::HashMap; /* diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/shared_cache_across_hierarchical_keyrings_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/shared_cache_across_hierarchical_keyrings_example.rs index caf21b3c7..78dee31ad 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/shared_cache_across_hierarchical_keyrings_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/shared_cache_across_hierarchical_keyrings_example.rs @@ -65,14 +65,14 @@ use super::create_branch_key_id::create_branch_key_id; use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::types::CacheType; -use aws_esdk::aws_cryptography_materialProviders::types::DefaultCache; -use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef; -use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration; -use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig; -use aws_esdk::aws_cryptography_keyStore::client as keystore_client; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::CacheType; +use aws_esdk::material_providers::types::DefaultCache; +use aws_esdk::material_providers::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::key_store::types::KmsConfiguration; +use aws_esdk::key_store::types::key_store_config::KeyStoreConfig; +use aws_esdk::key_store::client as keystore_client; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_keyring( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/version_branch_key_id_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/version_branch_key_id_example.rs index 655ba0be7..fedfd61bd 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/version_branch_key_id_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_hierarchical/version_branch_key_id_example.rs @@ -1,9 +1,9 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -use aws_esdk::aws_cryptography_keyStore::client as keystore_client; -use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig; -use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration; +use aws_esdk::key_store::client as keystore_client; +use aws_esdk::key_store::types::key_store_config::KeyStoreConfig; +use aws_esdk::key_store::types::KmsConfiguration; /* This example demonstrates configuring a KeyStore and then diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_keyring_example.rs index c4977af17..f5a4090ee 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_keyring_example.rs @@ -23,8 +23,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_keyring( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_keyring_example.rs index 8686e2e4f..0d8877c5c 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_keyring_example.rs @@ -40,9 +40,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::DiscoveryFilter; use std::collections::HashMap; use aws_config::Region; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_multi_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_multi_keyring_example.rs index 3dad49de4..635b60ede 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_multi_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_discovery_multi_keyring_example.rs @@ -42,9 +42,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::DiscoveryFilter; use std::collections::HashMap; use aws_config::Region; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_keyring_example.rs index ba0898f4e..96c05eb50 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_keyring_example.rs @@ -27,8 +27,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; use aws_config::Region; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_multi_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_multi_keyring_example.rs index 4ed152199..070c997a8 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_multi_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_mrk_multi_keyring_example.rs @@ -33,8 +33,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; use aws_config::Region; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_multi_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_multi_keyring_example.rs index edc9ffa05..cdff88810 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_multi_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_multi_keyring_example.rs @@ -43,8 +43,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; use aws_config::Region; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_rsa_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_rsa_keyring_example.rs index 71324d367..ab26df65d 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_rsa_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/aws_kms_rsa_keyring_example.rs @@ -20,9 +20,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_keyring( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/ephemeral_raw_ecdh_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/ephemeral_raw_ecdh_keyring_example.rs index 925dcc367..b8ce06cf3 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/ephemeral_raw_ecdh_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/ephemeral_raw_ecdh_keyring_example.rs @@ -40,10 +40,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-ecdh-k use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::RawEcdhStaticConfigurations; -use aws_esdk::aws_cryptography_materialProviders::types::EphemeralPrivateKeyToStaticPublicKeyInput; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::RawEcdhStaticConfigurations; +use aws_esdk::material_providers::types::EphemeralPrivateKeyToStaticPublicKeyInput; use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec; use std::collections::HashMap; use std::path::Path; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_discovery_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_discovery_keyring_example.rs index 4b0ecb436..3e684f4d0 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_discovery_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_discovery_keyring_example.rs @@ -29,11 +29,11 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-ecdh-k use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::KmsEcdhStaticConfigurations; -use aws_esdk::aws_cryptography_materialProviders::types::KmsPrivateKeyToStaticPublicKeyInput; -use aws_esdk::aws_cryptography_materialProviders::types::KmsPublicKeyDiscoveryInput; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::KmsEcdhStaticConfigurations; +use aws_esdk::material_providers::types::KmsPrivateKeyToStaticPublicKeyInput; +use aws_esdk::material_providers::types::KmsPublicKeyDiscoveryInput; use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec; use aws_smithy_types::Blob; use std::collections::HashMap; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_keyring_example.rs index c5dd7f48a..a069a8a97 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/kms_ecdh_keyring_example.rs @@ -43,10 +43,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-ecdh-k use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::KmsEcdhStaticConfigurations; -use aws_esdk::aws_cryptography_materialProviders::types::KmsPrivateKeyToStaticPublicKeyInput; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::KmsEcdhStaticConfigurations; +use aws_esdk::material_providers::types::KmsPrivateKeyToStaticPublicKeyInput; use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec; use std::collections::HashMap; use std::path::Path; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/public_key_discovery_raw_ecdh_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/public_key_discovery_raw_ecdh_keyring_example.rs index 8de9b2194..dc29efce6 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/public_key_discovery_raw_ecdh_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/public_key_discovery_raw_ecdh_keyring_example.rs @@ -46,11 +46,11 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-ecdh-k use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::RawEcdhStaticConfigurations; -use aws_esdk::aws_cryptography_materialProviders::types::PublicKeyDiscoveryInput; -use aws_esdk::aws_cryptography_materialProviders::types::EphemeralPrivateKeyToStaticPublicKeyInput; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::RawEcdhStaticConfigurations; +use aws_esdk::material_providers::types::PublicKeyDiscoveryInput; +use aws_esdk::material_providers::types::EphemeralPrivateKeyToStaticPublicKeyInput; use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec; use aws_smithy_types::Blob; use std::collections::HashMap; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/raw_ecdh_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/raw_ecdh_keyring_example.rs index 3f7796ec0..ffd7b2a52 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/raw_ecdh_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/ecdh/raw_ecdh_keyring_example.rs @@ -49,10 +49,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-ecdh-k use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::RawEcdhStaticConfigurations; -use aws_esdk::aws_cryptography_materialProviders::types::RawPrivateKeyToStaticPublicKeyInput; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::RawEcdhStaticConfigurations; +use aws_esdk::material_providers::types::RawPrivateKeyToStaticPublicKeyInput; use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec; use std::collections::HashMap; use std::fs::File; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/multi_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/multi_keyring_example.rs index 8f70f994f..6ef963300 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/multi_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/multi_keyring_example.rs @@ -43,9 +43,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::AesWrappingAlg; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::AesWrappingAlg; use std::collections::HashMap; use rand::RngCore; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_aes_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_aes_keyring_example.rs index c6d500fbb..9c682f2a8 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_aes_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_aes_keyring_example.rs @@ -25,9 +25,9 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-ke use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::AesWrappingAlg; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::AesWrappingAlg; use std::collections::HashMap; use rand::RngCore; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_rsa_keyring_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_rsa_keyring_example.rs index 04a2e5548..a6d003c3f 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_rsa_keyring_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/keyring/raw_rsa_keyring_example.rs @@ -49,9 +49,9 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-rsa-ke use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::PaddingScheme; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::PaddingScheme; use std::collections::HashMap; use std::fs::File; use std::io::Read; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/limit_encrypted_data_keys_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/limit_encrypted_data_keys_example.rs index 3ccda194a..868056e70 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/limit_encrypted_data_keys_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/limit_encrypted_data_keys_example.rs @@ -18,10 +18,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-ke use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::keyring::KeyringRef; -use aws_esdk::aws_cryptography_materialProviders::types::AesWrappingAlg; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::keyring::KeyringRef; +use aws_esdk::material_providers::types::AesWrappingAlg; use aws_esdk::types::error::Error::AwsEncryptionSdkException; use std::collections::HashMap; use rand::RngCore; diff --git a/AwsEncryptionSDK/runtimes/rust/examples/set_commitment_policy_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/set_commitment_policy_example.rs index d0cc05524..3cd8186e4 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/set_commitment_policy_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/set_commitment_policy_example.rs @@ -26,9 +26,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::EsdkCommitmentPolicy::ForbidEncryptAllowDecrypt; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::EsdkCommitmentPolicy::ForbidEncryptAllowDecrypt; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; use std::collections::HashMap; pub async fn encrypt_and_decrypt_with_keyring( diff --git a/AwsEncryptionSDK/runtimes/rust/examples/set_encryption_algorithm_suite_example.rs b/AwsEncryptionSDK/runtimes/rust/examples/set_encryption_algorithm_suite_example.rs index c62cfb464..7953be61a 100644 --- a/AwsEncryptionSDK/runtimes/rust/examples/set_encryption_algorithm_suite_example.rs +++ b/AwsEncryptionSDK/runtimes/rust/examples/set_encryption_algorithm_suite_example.rs @@ -41,10 +41,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-aes-ke use aws_esdk::client as esdk_client; use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId::AlgAes256GcmHkdfSha512CommitKey; -use aws_esdk::aws_cryptography_materialProviders::client as mpl_client; -use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig; -use aws_esdk::aws_cryptography_materialProviders::types::AesWrappingAlg; +use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId::AlgAes256GcmHkdfSha512CommitKey; +use aws_esdk::material_providers::client as mpl_client; +use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig; +use aws_esdk::material_providers::types::AesWrappingAlg; use std::collections::HashMap; use rand::RngCore; diff --git a/AwsEncryptionSDK/runtimes/rust/src/lib.rs b/AwsEncryptionSDK/runtimes/rust/src/lib.rs index 8d476fa29..53d53c28a 100644 --- a/AwsEncryptionSDK/runtimes/rust/src/lib.rs +++ b/AwsEncryptionSDK/runtimes/rust/src/lib.rs @@ -1,35 +1,97 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +//! The AWS Encryption SDK enables secure client-side encryption. +//! +//! Running `cargo test --examples` for this library runs these example keyrings. +//! +//! For details see the [Examples](https://github.com/aws/aws-encryption-sdk-dafny/tree/mainline/releases/rust/esdk/examples) +//! or the [Developer Guide](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/introduction.html) +//! +//! One of the most common keyrings that you can use is the AWS KMS Keyring. +//! The AWS KMS keyring uses symmetric encryption KMS keys to generate, encrypt and +//! decrypt data keys. You provide the KMS Key and KMS client configuration while +//! providing the keyring. +//! +//! [See full example](https://github.com/aws/aws-encryption-sdk-dafny/blob/mainline/releases/rust/esdk/examples/keyring/aws_kms_keyring_example.rs) +//! +//! ```text +//! // Initialize ESDK client and MPL client +//! let esdk_config = AwsEncryptionSdkConfig::builder().build()?; +//! let esdk_client = esdk_client::Client::from_conf(esdk_config)?; +//! +//! let mpl_config = MaterialProvidersConfig::builder().build()?; +//! let mpl = mpl_client::Client::from_conf(mpl_config)?; +//! +//! // Create KMS Keyring +//! let kms_keyring = mpl +//! .create_aws_kms_keyring() +//! // your configuration here +//! .send() +//! .await?; +//! +//! // Encrypt +//! let encryption_response = esdk_client.encrypt() +//! .plaintext(plaintext) +//! .keyring(kms_keyring) +//! .encryption_context(encryption_context) +//! .send() +//! .await?; +//! +//! let ciphertext = encryption_response +//! .ciphertext +//! .expect("Unable to unwrap ciphertext from encryption response"); +//! +//! // Decrypt +//! let decryption_response = esdk_client.decrypt() +//! .ciphertext(ciphertext) +//! .keyring(kms_keyring) +//! .encryption_context(encryption_context) +//! .send() +//! .await?; +//! +//! let decrypted_plaintext = decryption_response +//! .plaintext +//! .expect("Unable to unwrap plaintext from decryption response"); +//! +//! // Demonstrate that the decrypted plaintext is identical to the original plaintext. +//! // (This is an example for demonstration; you do not need to do this in your own code.) +//! assert_eq!(decrypted_plaintext, aws_smithy_types::Blob::new(plaintext), +//! "Decrypted plaintext should be identical to the original plaintext. Invalid decryption"); +//! +//! ``` + #![allow(warnings, unconditional_panic)] #![allow(nonstandard_style)] #![allow(clippy::never_loop)] #![allow(clippy::absurd_extreme_comparisons)] +/// Client for using encrypt and decrypt operations pub mod client; -pub mod conversions; -pub mod deps; -/// Common errors and error handling utilities. +/// Errors and error handling utilities. pub mod error; /// All operations that this crate can perform. pub mod operation; +/// Types for the transform client. pub mod types; -pub mod validation; #[cfg(feature = "wrapped-client")] pub mod wrapped; -mod standard_library_conversions; -mod standard_library_externs; - pub use client::Client; pub use types::aws_encryption_sdk_config::AwsEncryptionSdkConfig; -pub use crate::deps::aws_cryptography_keyStore; -pub use crate::deps::aws_cryptography_materialProviders; +/// Branch key support. See [Key Stores](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/keystores.html) +pub use crate::deps::aws_cryptography_keyStore as key_store; +/// [Key Rings](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html) and other fundamentals. +pub use crate::deps::aws_cryptography_materialProviders as material_providers; pub use crate::deps::aws_cryptography_primitives; +/// Rarely needed internal KMS Client, needed for [ClientSupplier](https://github.com/aws/aws-encryption-sdk-dafny/blob/mainline/releases/rust/esdk/examples/client_supplier/regional_role_client_supplier.rs) pub use crate::deps::com_amazonaws_kms; +mod standard_library_conversions; +mod standard_library_externs; + pub(crate) mod implementation_from_dafny; pub(crate) use crate::implementation_from_dafny::r#_Wrappers_Compile; pub(crate) use crate::implementation_from_dafny::software; @@ -47,6 +109,12 @@ pub(crate) use crate::implementation_from_dafny::HMAC; pub(crate) use crate::implementation_from_dafny::UTF8; pub(crate) use crate::implementation_from_dafny::UUID; +// Import smithy-generated modules +pub(crate) mod conversions; +pub(crate) mod deps; +pub(crate) mod validation; + +// Import externs pub(crate) mod aes_gcm; pub(crate) mod aes_kdf_ctr; pub(crate) mod concurrent_call;