Skip to content

chore(rust): Rust release version 1.1.0 #1885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions releases/rust/db_esdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws-db-esdk"
version = "1.0.0"
version = "1.1.0"
edition = "2021"
rust-version = "1.81.0"
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]
Expand All @@ -16,20 +16,20 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aws-config = "1.5.15"
aws-lc-rs = "1.12.2"
aws-lc-sys = "0.25.0"
aws-sdk-dynamodb = "1.62.0"
aws-sdk-kms = "1.57.0"
aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] }
aws-smithy-types = "1.2.12"
chrono = "0.4.39"
aws-config = "1.6.2"
aws-lc-rs = "1.13.1"
aws-lc-sys = "0.29.0"
aws-sdk-dynamodb = "1.73.0"
aws-sdk-kms = "1.67.0"
aws-smithy-runtime-api = {version = "1.8.0", features = ["client"] }
aws-smithy-types = "1.3.1"
chrono = "0.4.41"
cpu-time = "1.0.0"
dafny-runtime = { version = "0.2.0", features = ["sync"] }
dafny-runtime = { version = "0.3.0", features = ["sync", "small-int"] }
dashmap = "6.1.0"
pem = "3.0.4"
tokio = {version = "1.43.0", features = ["full"] }
uuid = { version = "1.12.1", features = ["v4"] }
pem = "3.0.5"
tokio = {version = "1.45.0", features = ["full"] }
uuid = { version = "1.16.0", features = ["v4"] }

[[example]]
name = "main"
8 changes: 7 additions & 1 deletion releases/rust/db_esdk/dafny_runtime_rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[package]
name = "dafny_runtime"
name = "dafny-runtime"
version = "0.3.0"
edition = "2021"
keywords = ["dafny"]
license = "ISC AND (Apache-2.0 OR ISC)"
description = "dafny-runtime is the runtime support library for Rust code gerated from Dafny."
repository = "https://github.com/aws/aws-database-encryption-sdk-dynamodb/tree/main/releases/rust/db_esdk/dafny_runtime_rust"
authors = ["AWS-CryptoTools"]
readme = "README.md"

[dependencies]
once_cell = "1.21.3"
Expand Down
53 changes: 24 additions & 29 deletions releases/rust/db_esdk/src/aes_gcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ impl AES_GCM {
msg: &::dafny_runtime::Sequence<u8>,
aad: &::dafny_runtime::Sequence<u8>,
) -> Rc<_Wrappers_Compile::Result<Rc<AESEncryptOutput>, Rc<DafnyError>>> {
let iv: Vec<u8> = iv.iter().collect();
let key: Vec<u8> = key.iter().collect();
let msg: Vec<u8> = msg.iter().collect();
let aad: Vec<u8> = aad.iter().collect();
let iv = &iv.to_array();
let key = &key.to_array();
let msg = &msg.to_array();
let aad = &aad.to_array();

if *self.keyLength() as usize != key.len() {
let msg = format!(
Expand All @@ -135,11 +135,11 @@ impl AES_GCM {
return enc_result(&msg);
}

match self.do_aes_encrypt(&iv, &key, &msg, &aad) {
match self.do_aes_encrypt(iv, key, msg, aad) {
Ok(x) => Rc::new(_Wrappers_Compile::Result::Success {
value: Rc::new(AESEncryptOutput::AESEncryptOutput {
cipherText: x.cipher_text.iter().cloned().collect(),
authTag: x.auth_tag.iter().cloned().collect(),
cipherText: dafny_runtime::Sequence::from_array_owned(x.cipher_text),
authTag: dafny_runtime::Sequence::from_array_owned(x.auth_tag),
}),
}),
Err(e) => {
Expand All @@ -158,11 +158,11 @@ impl AES_GCM {
iv: &::dafny_runtime::Sequence<u8>,
aad: &::dafny_runtime::Sequence<u8>,
) -> Rc<_Wrappers_Compile::Result<::dafny_runtime::Sequence<u8>, Rc<DafnyError>>> {
let key: Vec<u8> = key.iter().collect();
let cipher_text: Vec<u8> = cipher_text.iter().collect();
let auth_tag: Vec<u8> = auth_tag.iter().collect();
let iv: Vec<u8> = iv.iter().collect();
let aad: Vec<u8> = aad.iter().collect();
let key = &key.to_array();
let cipher_text = &cipher_text.to_array();
let auth_tag = &auth_tag.to_array();
let iv = &iv.to_array();
let aad = &aad.to_array();

if *self.keyLength() as usize != key.len() {
let msg = format!(
Expand Down Expand Up @@ -191,9 +191,9 @@ impl AES_GCM {
return dec_result(&msg);
}

match self.do_aes_decrypt(&key, &cipher_text, &auth_tag, &iv, &aad) {
match self.do_aes_decrypt(key, cipher_text, auth_tag, iv, aad) {
Ok(x) => Rc::new(_Wrappers_Compile::Result::Success {
value: x.iter().cloned().collect(),
value: dafny_runtime::Sequence::from_array_owned(x),
}),
Err(e) => {
let msg = format!("AES Decrypt : {}", e);
Expand All @@ -208,23 +208,18 @@ mod tests {
use super::*;
#[test]
fn test_generate() {
let iv: ::dafny_runtime::Sequence<u8> = [1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
.iter()
.cloned()
.collect();
let key: ::dafny_runtime::Sequence<u8> = [
let iv: ::dafny_runtime::Sequence<u8> = dafny_runtime::Sequence::from_array_owned(vec![
1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
]);
let key: ::dafny_runtime::Sequence<u8> = dafny_runtime::Sequence::from_array_owned(vec![
2u8, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33,
]
.iter()
.cloned()
.collect();
let msg: ::dafny_runtime::Sequence<u8> = [2u8, 4, 6, 8, 10, 12].iter().cloned().collect();
let aad: ::dafny_runtime::Sequence<u8> =
[3u8, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
.iter()
.cloned()
.collect();
]);
let msg: ::dafny_runtime::Sequence<u8> =
dafny_runtime::Sequence::from_array_owned(vec![2u8, 4, 6, 8, 10, 12]);
let aad: ::dafny_runtime::Sequence<u8> = dafny_runtime::Sequence::from_array_owned(vec![
3u8, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
]);

let alg = AES_GCM::AES_GCM {
keyLength: 32,
Expand Down
8 changes: 4 additions & 4 deletions releases/rust/db_esdk/src/aes_kdf_ctr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ pub mod AesKdfCtr {
Rc<crate::software::amazon::cryptography::primitives::internaldafny::types::Error>,
>,
> {
let nonce: Vec<u8> = nonce.iter().collect();
let key: Vec<u8> = key.iter().collect();
match ctr_stream(&nonce, &key, length) {
let nonce = &nonce.to_array();
let key = &key.to_array();
match ctr_stream(nonce, key, length) {
Ok(x) => Rc::new(_Wrappers_Compile::Result::Success {
value: x.iter().cloned().collect(),
value: dafny_runtime::Sequence::from_array_owned(x),
}),
Err(e) => {
let msg = format!("Aes Kdf Ctr : {}", e);
Expand Down
13 changes: 13 additions & 0 deletions releases/rust/db_esdk/src/dafny_libraries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,19 @@ pub mod DafnyLibraries {
let file_name = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(path);
let path = Path::new(&file_name);

if let Some(parent) = path.parent() {
if let Err(why) = std::fs::create_dir_all(parent) {
let err_msg = format!(
"couldn't create directory {} from {}: {}",
path.display(),
curr_dir(),
why
);
let err_msg = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&err_msg);
return (true, err_msg);
}
}

let maybe_file = std::fs::OpenOptions::new()
.append(append)
.write(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
/// Inputs for creating a Default Cryptographic Materials Manager.
pub struct CreateDefaultCryptographicMaterialsManagerInput {
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub keyring: ::std::option::Option<
crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef,
>,
}
impl CreateDefaultCryptographicMaterialsManagerInput {
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn keyring(
&self,
) -> &::std::option::Option<
Expand All @@ -38,7 +38,7 @@ pub struct CreateDefaultCryptographicMaterialsManagerInputBuilder {
>,
}
impl CreateDefaultCryptographicMaterialsManagerInputBuilder {
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn keyring(
mut self,
input: impl ::std::convert::Into<
Expand All @@ -48,7 +48,7 @@ impl CreateDefaultCryptographicMaterialsManagerInputBuilder {
self.keyring = ::std::option::Option::Some(input.into());
self
}
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn set_keyring(
mut self,
input: ::std::option::Option<
Expand All @@ -58,7 +58,7 @@ impl CreateDefaultCryptographicMaterialsManagerInputBuilder {
self.keyring = input;
self
}
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn get_keyring(
&self,
) -> &::std::option::Option<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl CreateDefaultCryptographicMaterialsManagerFluentBuilder {
crate::deps::aws_cryptography_materialProviders::operation::create_default_cryptographic_materials_manager::CreateDefaultCryptographicMaterialsManager::send(&self.client, input).await
}

/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn keyring(
mut self,
input: impl ::std::convert::Into<
Expand All @@ -74,7 +74,7 @@ impl CreateDefaultCryptographicMaterialsManagerFluentBuilder {
self.inner = self.inner.keyring(input.into());
self
}
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn set_keyring(
mut self,
input: ::std::option::Option<
Expand All @@ -84,7 +84,7 @@ impl CreateDefaultCryptographicMaterialsManagerFluentBuilder {
self.inner = self.inner.set_keyring(input);
self
}
/// The Keyring that the created Default Cryprographic Materials Manager will use to wrap data keys.
/// The Keyring that the created Default Cryptographic Materials Manager will use to wrap data keys.
pub fn get_keyring(
&self,
) -> &::std::option::Option<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
/// Inputs for creating an Required Encryption Context Cryptographic Materials Manager.
pub struct CreateRequiredEncryptionContextCmmInput {
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
pub keyring: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::keyring::KeyringRef>,
/// A list of Encryption Context keys which are required to be supplied during encryption and decryption, and correspond to Encryption Context key-value pairs which are not stored on the resulting message.
pub required_encryption_context_keys: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
pub underlying_cmm: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
}
impl CreateRequiredEncryptionContextCmmInput {
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
pub fn keyring(
&self,
) -> &::std::option::Option<
Expand All @@ -27,7 +27,7 @@ impl CreateRequiredEncryptionContextCmmInput {
) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.required_encryption_context_keys
}
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
pub fn underlying_cmm(&self) -> &::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>{
&self.underlying_cmm
}
Expand All @@ -50,7 +50,7 @@ pub(crate) required_encryption_context_keys: ::std::option::Option<::std::vec::V
pub(crate) underlying_cmm: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
}
impl CreateRequiredEncryptionContextCmmInputBuilder {
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
pub fn keyring(
mut self,
input: impl ::std::convert::Into<
Expand All @@ -60,7 +60,7 @@ impl CreateRequiredEncryptionContextCmmInputBuilder {
self.keyring = ::std::option::Option::Some(input.into());
self
}
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
pub fn set_keyring(
mut self,
input: ::std::option::Option<
Expand All @@ -70,7 +70,7 @@ impl CreateRequiredEncryptionContextCmmInputBuilder {
self.keyring = input;
self
}
/// The Keyring that the created Cryprographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryprographic Materials Manager must be specified as input.
/// The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Required Encryption Context CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.
pub fn get_keyring(
&self,
) -> &::std::option::Option<
Expand Down Expand Up @@ -100,23 +100,23 @@ impl CreateRequiredEncryptionContextCmmInputBuilder {
) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.required_encryption_context_keys
}
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
pub fn underlying_cmm(
mut self,
input: impl ::std::convert::Into<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
) -> Self {
self.underlying_cmm = ::std::option::Option::Some(input.into());
self
}
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
pub fn set_underlying_cmm(
mut self,
input: ::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>,
) -> Self {
self.underlying_cmm = input;
self
}
/// The Cryprographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryprographic Materials Manager must be specified.
/// The Cryptographic Materials Manager that the created Required Encryption Context Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.
pub fn get_underlying_cmm(&self) -> &::std::option::Option<crate::deps::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef>{
&self.underlying_cmm
}
Expand Down
Loading
Loading