Skip to content
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

Updates outdated dependencies #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions serde-encrypt-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repository = "https://github.com/laysakura/serde-encrypt"
version = "0.7.0"

[dependencies]
chacha20poly1305 = {version = "0.8", default-features = false, features = ["alloc", "xchacha20poly1305"]}
crypto_box = {version = "0.6"}
crypto_secretbox = {version = "0.1.1", default-features = false, features = ["chacha20", "alloc"]}
crypto_box = {version = "0.9.1", features = ["chacha20"]}

rand = {version = "0.8", default-features = false}
rand_chacha = {version = "0.3", default-features = false}
Expand All @@ -25,6 +25,6 @@ spin = {version = "0.9", default-features = false, features = ["spin_mutex", "la
default = ["std"]

std = [
"chacha20poly1305/std",
"crypto_secretbox/std",
"rand_chacha/std",
]
4 changes: 2 additions & 2 deletions serde-encrypt-core/src/encrypt/plain_message_public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::{
random::RngSingleton,
};
use alloc::vec::Vec;
use chacha20poly1305::{aead::Payload, XNonce};
use crypto_box::{aead::Aead, ChaChaBox};
use crypto_secretbox::{aead::Payload, AeadCore, Nonce as XNonce};

use super::encrypted_message::EncryptedMessage;

Expand Down Expand Up @@ -81,6 +81,6 @@ pub trait PlainMessagePublicKeyCore {
/// Generate random nonce which is large enough (24-byte) to rarely conflict.
fn generate_nonce() -> XNonce {
let mut rng = Self::R::instance();
crypto_box::generate_nonce(rng.deref_mut())
crypto_box::ChaChaBox::generate_nonce(rng.deref_mut())
}
}
4 changes: 2 additions & 2 deletions serde-encrypt-core/src/encrypt/plain_message_shared_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub use shared_key_deterministic_core::PlainMessageSharedKeyDeterministicCore;
use super::encrypted_message::EncryptedMessage;
use crate::{error::Error, key::as_shared_key::AsSharedKey};
use alloc::{format, vec::Vec};
use chacha20poly1305::{XChaCha20Poly1305, XNonce};
use crypto_box::aead::{Aead, NewAead};
use crypto_box::aead::Aead;
use crypto_secretbox::{KeyInit, Nonce as XNonce, XChaCha20Poly1305};

/// Encrypt into EncryptedMessage
fn encrypt<S>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::encrypt::encrypted_message::EncryptedMessage;
use crate::random::RngSingleton;
use crate::{error::Error, key::as_shared_key::AsSharedKey};
use alloc::vec::Vec;
use chacha20poly1305::XNonce;
use core::ops::DerefMut;
use crypto_secretbox::{AeadCore, Nonce as XNonce};

use super::{decrypt, encrypt};

Expand Down Expand Up @@ -47,6 +47,6 @@ pub trait PlainMessageSharedKeyCore {
/// Generate random nonce which is large enough (24-byte) to rarely conflict.
fn generate_nonce() -> XNonce {
let mut rng = Self::R::instance();
crypto_box::generate_nonce(rng.deref_mut())
crypto_box::ChaChaBox::generate_nonce(rng.deref_mut())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
encrypt::encrypted_message::EncryptedMessage, error::Error, key::as_shared_key::AsSharedKey,
};
use alloc::vec::Vec;
use chacha20poly1305::XNonce;
use crypto_secretbox::Nonce as XNonce;

use super::{decrypt, encrypt};

Expand Down
2 changes: 1 addition & 1 deletion serde-encrypt-core/src/key/as_shared_key.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Keys for common key cryptosystem.

use crate::random::RngSingleton;
use chacha20poly1305::Key as ChaChaKey;
use core::{convert::TryInto, ops::DerefMut};
use crypto_secretbox::Key as ChaChaKey;
use rand::RngCore;

/// 32-byte key shared among sender and receiver secretly.
Expand Down
2 changes: 1 addition & 1 deletion serde-encrypt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ version = "0.7.0"
serde-encrypt-core = {version = "0.7.0", path = "../serde-encrypt-core", default-features = false}

bincode = {version = "1.3", optional = true}
postcard = {version = "0.7", default-features = false, features = ["alloc"]}
postcard = {version = "1.1.1", default-features = false, features = ["alloc"]}
serde = {version = "1.0", default-features = false}
serde_cbor = {version = "0.11", default-features = false, features = ["alloc"]}

Expand Down
10 changes: 6 additions & 4 deletions serde-encrypt/src/shared_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use serde::{Deserialize, Serialize};

use crate::{AsSharedKey, random::RngSingletonImpl};
use crate::traits::SerdeEncryptPublicKey;
use crate::{random::RngSingletonImpl, AsSharedKey};

/// 32-byte key shared among sender and receiver secretly.
///
Expand Down Expand Up @@ -52,13 +52,15 @@ cfg_if::cfg_if! {

#[cfg(test)]
mod test {
use std::convert::TryInto;
use super::*;
use std::convert::TryInto;

#[test]
fn build_sharedkey_from_array() {
const STATIC_ARRAY: [u8; 32] = [1, 1, 4, 5, 1, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const STATIC_ARRAY: [u8; 32] = [
1, 1, 4, 5, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
];

let runtime_array: [u8; 32] = Vec::from(STATIC_ARRAY).try_into().unwrap();

Expand Down
Loading