Skip to content

Commit

Permalink
Bump cryptraits version 👍
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyer committed Jan 12, 2022
1 parent f338f0b commit 080dd93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 80 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "xxxdh"
license = "MIT"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = ["Oleksandr Yermakov <olexander.yermakov@gmail.com>"]
categories = ["cryptography"]
Expand All @@ -12,8 +12,8 @@ description = "Pure Rust X3DH key exchange protocol implementation"

[dependencies]
aes-gcm = {version = "0.9.4", optional = true }
cryptimitives = "0.5.0"
cryptraits = "0.2.0"
cryptimitives = "0.6.0"
cryptraits = "0.3.0"
rand_core = "0.6.3"
thiserror = "1.0.30"
zeroize = "1.4.3"
Expand Down
75 changes: 0 additions & 75 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,3 @@ mod storage;

pub use protocol::*;
pub use storage::*;

// #[cfg(test)]
// mod tests {
// #[cfg(all(
// feature = "x25519-ristretto",
// feature = "hkdf-sha512",
// feature = "aead-aes-gcm"
// ))]
// #[test]
// fn it_should_exchange_keys_x25519_ristretto_sha512_aes_gcm() {
// use rand_core::OsRng;

// use crate::{
// inmem, sha512, x25519_ristretto, IdentityKeyStorage, OnetimeKeyStorage, PreKeyStorage,
// Protocol, Sign, SignatureStorage, ToVec,
// };

// let alice_identity = x25519_ristretto::IdentityKeyPair::generate_with(OsRng);
// let alice_prekey = x25519_ristretto::PreKeyPair::generate_with(OsRng);
// let alice_signature = alice_identity.sign(&alice_prekey.to_public().to_vec());
// let mut alice_protocol = Protocol::<
// x25519_ristretto::IdentitySecretKey,
// x25519_ristretto::EphemeralSecretKey,
// x25519_ristretto::Signature,
// inmem::Storage<_, _>,
// sha512::Kdf,
// crate::aes_gcm::Aead,
// >::new(alice_identity, alice_prekey, alice_signature, None);

// let onetime_keypair = x25519_ristretto::OnetimeKeyPair::generate_with(OsRng);

// let bob_identity = x25519_ristretto::IdentityKeyPair::generate_with(OsRng);
// let bob_prekey = x25519_ristretto::IdentityKeyPair::generate_with(OsRng);
// let bob_signature = bob_identity.sign(&bob_prekey.to_public().to_vec());
// let mut bob_protocol = Protocol::<
// x25519_ristretto::IdentitySecretKey,
// x25519_ristretto::EphemeralSecretKey,
// x25519_ristretto::Signature,
// inmem::Storage<_, _>,
// sha512::Kdf,
// crate::aes_gcm::Aead,
// >::new(
// bob_identity,
// bob_prekey,
// bob_signature,
// Some(vec![onetime_keypair]),
// );

// let bob_identity = bob_protocol.storage.get_identity_key_pair().to_public();
// let bob_prekey = bob_protocol.storage.get_prekey_pair().to_public();
// let bob_signature = bob_protocol
// .storage
// .get_signature(&bob_prekey)
// .unwrap()
// .unwrap();
// let onetime_key = bob_protocol.storage.provide_ontime_key().unwrap().unwrap();

// let (alice_identity, alice_ephemeral_key, bob_onetime_key, alice_sk, nonce, ciphertext) =
// alice_protocol
// .prepare_init_msg(&bob_identity, &bob_prekey, bob_signature, onetime_key)
// .unwrap();

// let bob_sk = bob_protocol
// .derive_shared_secret(
// &alice_identity,
// &alice_ephemeral_key,
// &bob_onetime_key,
// &nonce,
// &ciphertext,
// )
// .unwrap();

// assert_eq!(alice_sk, bob_sk);
// }
// }
4 changes: 2 additions & 2 deletions src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ where

let cipher = CIPHER::new(&sk);

let ciphertext = cipher.encrypt(&nonce, &data).unwrap();
let ciphertext = cipher.encrypt(&nonce, &data, None).unwrap();

Ok((
self.storage.get_identity_key_pair().to_public(),
Expand Down Expand Up @@ -157,7 +157,7 @@ where
])?;

let cipher = CIPHER::new(&sk);
cipher.decrypt(nonce, ciphertext)?;
cipher.decrypt(nonce, ciphertext, None)?;

self.storage.save_identity(sender_identity)?;

Expand Down

0 comments on commit 080dd93

Please sign in to comment.