Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3491762
D5880.id19893.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
51 KB
Referenced Files
None
Subscribers
None
D5880.id19893.diff
View Options
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -7,8 +7,6 @@
lib/node_modules
-native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/target
-
web/node_modules
web/dist
diff --git a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/Cargo.toml b/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/Cargo.toml
deleted file mode 100644
--- a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/Cargo.toml
+++ /dev/null
@@ -1,22 +0,0 @@
-[package]
-name = "opaque-ke-cxx"
-version = "0.1.0"
-edition = "2021"
-license = "BSD-3-Clause"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-argon2 = "0.3"
-opaque-ke = "1.2.0"
-curve25519-dalek = "3"
-rand = "0.8"
-sha2 = "0.9"
-digest = "0.9"
-cxx = "1.0"
-
-[build-dependencies]
-cxx-build = "1.0"
-
-[lib]
-crate-type = ["staticlib"]
diff --git a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/build.rs b/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/build.rs
deleted file mode 100644
--- a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/build.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
- let _build = cxx_build::bridge("src/lib.rs");
-
- println!("cargo:rerun-if-changed=src/lib.rs");
-}
diff --git a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/src/lib.rs b/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/src/lib.rs
deleted file mode 100644
--- a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/src/lib.rs
+++ /dev/null
@@ -1,860 +0,0 @@
-use argon2::Argon2;
-use digest::generic_array::GenericArray;
-use digest::Digest;
-use opaque_ke::ciphersuite::CipherSuite;
-use opaque_ke::errors::{InternalPakeError, ProtocolError};
-use opaque_ke::hash::Hash;
-use opaque_ke::keypair::Key;
-use opaque_ke::slow_hash::SlowHash;
-use opaque_ke::{
- ClientLogin, ClientLoginFinishParameters, ClientLoginStartParameters, ClientRegistration,
- ClientRegistrationFinishParameters, CredentialFinalization, CredentialRequest,
- CredentialResponse, RegistrationRequest, RegistrationResponse, RegistrationUpload, ServerLogin,
- ServerLoginStartParameters, ServerRegistration,
-};
-use rand::rngs::OsRng;
-
-struct Cipher;
-
-impl CipherSuite for Cipher {
- type Group = curve25519_dalek::ristretto::RistrettoPoint;
- type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
- type Hash = sha2::Sha512;
- type SlowHash = ArgonWrapper;
-}
-
-struct ArgonWrapper(Argon2<'static>);
-
-impl<D: Hash> SlowHash<D> for ArgonWrapper {
- fn hash(
- input: GenericArray<u8, <D as Digest>::OutputSize>,
- ) -> Result<Vec<u8>, InternalPakeError> {
- let params = Argon2::default();
- let mut output = vec![0u8; <D as Digest>::output_size()];
- params
- .hash_password_into(&input, &[0; argon2::MIN_SALT_LEN], &mut output)
- .map_err(|_| InternalPakeError::SlowHashError)?;
- Ok(output)
- }
-}
-
-#[cxx::bridge]
-mod ffi {
- struct ClientRegistrationStartResult {
- message: Vec<u8>,
- state: Vec<u8>,
- }
-
- #[derive(Debug)]
- struct ClientRegistrationFinishResult {
- message: Vec<u8>,
- }
-
- struct ClientLoginStartResult {
- message: Vec<u8>,
- state: Vec<u8>,
- }
-
- #[derive(Debug)]
- struct ClientLoginFinishResult {
- message: Vec<u8>,
- session_key: Vec<u8>,
- }
-
- struct ServerKeyPair {
- public: Vec<u8>,
- private: Vec<u8>,
- }
-
- struct ServerRegistrationStartResult {
- message: Vec<u8>,
- state: Vec<u8>,
- }
-
- struct ServerRegistrationFinishResult {
- password_file: Vec<u8>,
- }
-
- struct ServerLoginStartResult {
- message: Vec<u8>,
- state: Vec<u8>,
- }
-
- struct ServerLoginFinishResult {
- session_key: Vec<u8>,
- }
-
- extern "Rust" {
- fn client_register_cxx(password: String) -> Result<ClientRegistrationStartResult>;
- fn client_register_finish_cxx(
- client_register_state: Vec<u8>,
- server_message: Vec<u8>,
- ) -> Result<ClientRegistrationFinishResult>;
- fn client_login_cxx(password: String) -> Result<ClientLoginStartResult>;
- fn client_login_finish_cxx(
- client_login_state: Vec<u8>,
- server_message: Vec<u8>,
- ) -> Result<ClientLoginFinishResult>;
- fn server_kp() -> ServerKeyPair;
- fn server_register_cxx(
- registration_request: Vec<u8>,
- server_public_key: Vec<u8>,
- ) -> Result<ServerRegistrationStartResult>;
- fn server_register_finish_cxx(
- server_register_state: Vec<u8>,
- client_message: Vec<u8>,
- ) -> Result<ServerRegistrationFinishResult>;
- fn server_login_cxx(
- password_file: Vec<u8>,
- server_private_key: Vec<u8>,
- login_request: Vec<u8>,
- ) -> Result<ServerLoginStartResult>;
- fn server_login_finish_cxx(
- server_login_state: Vec<u8>,
- client_message: Vec<u8>,
- ) -> Result<ServerLoginFinishResult>;
- }
-}
-
-fn client_register_cxx(
- password: String,
-) -> Result<ffi::ClientRegistrationStartResult, ProtocolError> {
- let mut client_rng = OsRng;
- let c = ClientRegistration::<Cipher>::start(&mut client_rng, password.as_bytes())?;
-
- Ok(ffi::ClientRegistrationStartResult {
- message: c.message.serialize(),
- state: c.state.serialize(),
- })
-}
-
-fn client_register_finish_cxx(
- client_register_state: Vec<u8>,
- server_message: Vec<u8>,
-) -> Result<ffi::ClientRegistrationFinishResult, ProtocolError> {
- let client_register_state = ClientRegistration::<Cipher>::deserialize(&client_register_state)?;
- let server_message = RegistrationResponse::<Cipher>::deserialize(&server_message)?;
-
- let mut client_rng = OsRng;
- let c = client_register_state.finish(
- &mut client_rng,
- server_message,
- ClientRegistrationFinishParameters::default(),
- )?;
-
- Ok(ffi::ClientRegistrationFinishResult {
- message: c.message.serialize(),
- })
-}
-
-fn client_login_cxx(password: String) -> Result<ffi::ClientLoginStartResult, ProtocolError> {
- let mut client_rng = OsRng;
- let c = ClientLogin::<Cipher>::start(
- &mut client_rng,
- password.as_bytes(),
- ClientLoginStartParameters::default(),
- )?;
-
- Ok(ffi::ClientLoginStartResult {
- message: c.message.serialize()?,
- state: c.state.serialize()?,
- })
-}
-
-fn client_login_finish_cxx(
- client_login_state: Vec<u8>,
- server_message: Vec<u8>,
-) -> Result<ffi::ClientLoginFinishResult, ProtocolError> {
- let client_login_state = ClientLogin::<Cipher>::deserialize(&client_login_state)?;
- let server_message = CredentialResponse::<Cipher>::deserialize(&server_message)?;
-
- // An InvalidLogin will be emitted in this step in the case of an incorrect password
- let c = client_login_state.finish(server_message, ClientLoginFinishParameters::default())?;
-
- Ok(ffi::ClientLoginFinishResult {
- message: c.message.serialize()?,
- session_key: c.session_key,
- })
-}
-
-fn server_kp() -> ffi::ServerKeyPair {
- let mut rng = OsRng;
- let keypair = Cipher::generate_random_keypair(&mut rng);
- let public_key = keypair.public().to_vec();
- let private_key = keypair.private().to_vec();
- ffi::ServerKeyPair {
- public: public_key,
- private: private_key,
- }
-}
-
-fn server_register_cxx(
- registration_request: Vec<u8>,
- server_public_key: Vec<u8>,
-) -> Result<ffi::ServerRegistrationStartResult, ProtocolError> {
- let registration_request = RegistrationRequest::<Cipher>::deserialize(®istration_request)?;
- let server_public_key = Key::from_bytes(&server_public_key)?;
-
- let mut server_rng = OsRng;
- let s =
- ServerRegistration::<Cipher>::start(&mut server_rng, registration_request, &server_public_key)?;
-
- Ok(ffi::ServerRegistrationStartResult {
- message: s.message.serialize(),
- state: s.state.serialize(),
- })
-}
-
-fn server_register_finish_cxx(
- server_register_state: Vec<u8>,
- client_message: Vec<u8>,
-) -> Result<ffi::ServerRegistrationFinishResult, ProtocolError> {
- let server_register_state = ServerRegistration::<Cipher>::deserialize(&server_register_state)?;
- let client_message = RegistrationUpload::<Cipher>::deserialize(&client_message)?;
-
- let s = server_register_state.finish(client_message)?;
-
- Ok(ffi::ServerRegistrationFinishResult {
- password_file: s.serialize(),
- })
-}
-
-fn server_login_cxx(
- password_file: Vec<u8>,
- server_private_key: Vec<u8>,
- login_request: Vec<u8>,
-) -> Result<ffi::ServerLoginStartResult, ProtocolError> {
- let password_file = ServerRegistration::<Cipher>::deserialize(&password_file)?;
- let server_private_key = Key::from_bytes(&server_private_key)?;
- let login_request = CredentialRequest::<Cipher>::deserialize(&login_request)?;
-
- let mut server_rng = OsRng;
- let s = ServerLogin::start(
- &mut server_rng,
- password_file,
- &server_private_key,
- login_request,
- ServerLoginStartParameters::default(),
- )?;
-
- Ok(ffi::ServerLoginStartResult {
- message: s.message.serialize()?,
- state: s.state.serialize()?,
- })
-}
-
-fn server_login_finish_cxx(
- server_login_state: Vec<u8>,
- client_message: Vec<u8>,
-) -> Result<ffi::ServerLoginFinishResult, ProtocolError> {
- let server_login_state = ServerLogin::<Cipher>::deserialize(&server_login_state)?;
- let client_message = CredentialFinalization::<Cipher>::deserialize(&client_message)?;
-
- let s = server_login_state.finish(client_message)?;
-
- Ok(ffi::ServerLoginFinishResult {
- session_key: s.session_key,
- })
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use opaque_ke::{ServerLogin, ServerLoginStartParameters, ServerRegistration};
-
- macro_rules! assert_err {
- ($expression:expr, $($pattern:tt)+) => {
- match $expression {
- $($pattern)+ => (),
- ref e => panic!("expected `{}` but got `{:?}`", stringify!($($pattern)+), e),
- }
- }
- }
-
- #[test]
- fn test_client_register_cxx_ok() {
- let password = String::from("hunter2");
- assert!(client_register_cxx(password).is_ok());
- }
-
- #[test]
- fn test_client_register_cxx_ok_empty_string() {
- let password = String::from("");
- assert!(client_register_cxx(password).is_ok());
- }
-
- #[test]
- fn test_client_register_finish_cxx_ok() {
- let password = "hunter2";
- let mut client_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, password.as_bytes()).unwrap();
- let mut rng = OsRng;
- let server_kp = Cipher::generate_random_keypair(&mut rng);
- let mut server_rng = OsRng;
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- &server_kp.public(),
- )
- .unwrap();
- let client_register_state = client_registration_start_result.state.serialize();
- let server_message = server_registration_start_result.message.serialize();
- assert!(client_register_finish_cxx(client_register_state, server_message).is_ok());
- }
-
- #[test]
- fn test_client_register_finish_cxx_err_state_deserialization_failed() {
- let password = "hunter2";
- let mut client_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, password.as_bytes()).unwrap();
- let mut rng = OsRng;
- let server_kp = Cipher::generate_random_keypair(&mut rng);
- let mut server_rng = OsRng;
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- &server_kp.public(),
- )
- .unwrap();
- let client_register_state = vec![];
- let server_message = server_registration_start_result.message.serialize();
- let client_finish_registration_result =
- client_register_finish_cxx(client_register_state, server_message);
- assert!(client_finish_registration_result.is_err());
- assert_err!(
- client_finish_registration_result,
- Err(ProtocolError::VerificationError(_))
- );
- }
-
- #[test]
- fn test_client_register_finish_cxx_err_message_deserialization_failed() {
- let password = "hunter2";
- let mut client_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, password.as_bytes()).unwrap();
- let client_register_state = client_registration_start_result.state.serialize();
- let server_message = vec![];
- let client_finish_registration_result =
- client_register_finish_cxx(client_register_state, server_message);
- assert!(client_finish_registration_result.is_err());
- assert_err!(
- client_finish_registration_result,
- Err(ProtocolError::VerificationError(_))
- );
- }
-
- #[test]
- fn test_client_login_cxx_ok() {
- let password = String::from("hunter2");
- assert!(client_login_cxx(password).is_ok());
- }
-
- #[test]
- fn test_client_login_cxx_ok_empty_string() {
- let password = String::from("");
- assert!(client_login_cxx(password).is_ok());
- }
-
- #[test]
- fn test_client_login_finish_cxx_ok() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- let server_login_start_result = ServerLogin::start(
- &mut server_rng,
- p_file,
- &server_kp.private(),
- client_login_start_result.message,
- ServerLoginStartParameters::default(),
- )
- .unwrap();
- assert!(client_login_finish_cxx(
- client_login_start_result.state.serialize().unwrap(),
- server_login_start_result.message.serialize().unwrap()
- )
- .is_ok());
- }
-
- #[test]
- fn test_client_login_finish_cxx_err_state_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- let server_login_start_result = ServerLogin::start(
- &mut server_rng,
- p_file,
- &server_kp.private(),
- client_login_start_result.message,
- ServerLoginStartParameters::default(),
- )
- .unwrap();
- assert_err!(
- client_login_finish_cxx(
- vec![],
- server_login_start_result.message.serialize().unwrap()
- ),
- Err(ProtocolError::VerificationError(_))
- );
- }
-
- #[test]
- fn test_client_login_finish_cxx_err_message_deserialization_failed() {
- let mut client_rng = OsRng;
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- assert_err!(
- client_login_finish_cxx(client_login_start_result.state.serialize().unwrap(), vec![]),
- Err(ProtocolError::VerificationError(_))
- );
- }
-
- #[test]
- fn test_server_kp_ok() {
- let keys = server_kp();
- assert_eq!(keys.public.len(), 32);
- assert_eq!(keys.private.len(), 32);
- }
-
- #[test]
- fn test_server_register_cxx_ok() {
- let password = "hunter2";
- let mut client_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, password.as_bytes()).unwrap();
- let mut rng = OsRng;
- let server_kp = Cipher::generate_random_keypair(&mut rng);
- assert!(server_register_cxx(
- client_registration_start_result.message.serialize(),
- server_kp.public().to_vec()
- )
- .is_ok())
- }
-
- #[test]
- fn test_server_register_cxx_err_request_deserialization_failed() {
- let mut rng = OsRng;
- let server_kp = Cipher::generate_random_keypair(&mut rng);
- assert!(server_register_cxx(vec![], server_kp.public().to_vec()).is_err())
- }
-
- #[test]
- fn test_server_register_cxx_err_key_deserialization_failed() {
- let password = "hunter2";
- let mut client_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, password.as_bytes()).unwrap();
- assert!(
- server_register_cxx(client_registration_start_result.message.serialize(), vec![]).is_err()
- )
- }
-
- #[test]
- fn test_server_register_finish_cxx_ok() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- assert!(server_register_finish_cxx(
- server_registration_start_result.state.serialize(),
- client_registration_finish_result.message.serialize()
- )
- .is_ok());
- }
-
- #[test]
- fn test_server_register_finish_cxx_err_state_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- assert!(server_register_finish_cxx(
- vec![],
- client_registration_finish_result.message.serialize()
- )
- .is_err());
- }
-
- #[test]
- fn test_server_register_finish_cxx_err_message_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- assert!(
- server_register_finish_cxx(server_registration_start_result.state.serialize(), vec![])
- .is_err()
- );
- }
-
- #[test]
- fn test_server_login_cxx_ok() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- assert!(server_login_cxx(
- p_file.serialize(),
- server_kp.private().to_vec(),
- client_login_start_result.message.serialize().unwrap()
- )
- .is_ok());
- }
-
- #[test]
- fn test_server_login_cxx_err_password_file_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- assert!(server_login_cxx(
- vec![],
- server_kp.private().to_vec(),
- client_login_start_result.message.serialize().unwrap()
- )
- .is_err());
- }
-
- #[test]
- fn test_server_login_cxx_err_private_key_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- assert!(server_login_cxx(
- p_file.serialize(),
- vec![],
- client_login_start_result.message.serialize().unwrap()
- )
- .is_err());
- }
-
- #[test]
- fn test_server_login_cxx_err_login_request_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- assert!(server_login_cxx(p_file.serialize(), server_kp.private().to_vec(), vec![]).is_err());
- }
-
- #[test]
- fn test_server_login_finish_cxx_ok() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- let server_login_start_result = ServerLogin::start(
- &mut server_rng,
- p_file,
- &server_kp.private(),
- client_login_start_result.message,
- ServerLoginStartParameters::default(),
- )
- .unwrap();
- let client_login_finish_result = client_login_start_result
- .state
- .finish(
- server_login_start_result.message,
- ClientLoginFinishParameters::default(),
- )
- .unwrap();
- assert!(server_login_finish_cxx(
- server_login_start_result.state.serialize().unwrap(),
- client_login_finish_result.message.serialize().unwrap()
- )
- .is_ok());
- }
-
- #[test]
- fn test_server_login_finish_cxx_err_state_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- let server_login_start_result = ServerLogin::start(
- &mut server_rng,
- p_file,
- &server_kp.private(),
- client_login_start_result.message,
- ServerLoginStartParameters::default(),
- )
- .unwrap();
- let client_login_finish_result = client_login_start_result
- .state
- .finish(
- server_login_start_result.message,
- ClientLoginFinishParameters::default(),
- )
- .unwrap();
- assert!(server_login_finish_cxx(
- vec![],
- client_login_finish_result.message.serialize().unwrap()
- )
- .is_err());
- }
-
- #[test]
- fn test_server_login_finish_cxx_err_message_deserialization_failed() {
- let mut client_rng = OsRng;
- let mut server_rng = OsRng;
- let client_registration_start_result =
- ClientRegistration::<Cipher>::start(&mut client_rng, b"hunter2").unwrap();
- let server_kp = Cipher::generate_random_keypair(&mut server_rng);
- let server_registration_start_result = ServerRegistration::<Cipher>::start(
- &mut server_rng,
- client_registration_start_result.message,
- server_kp.public(),
- )
- .unwrap();
- let client_registration_finish_result = client_registration_start_result
- .state
- .finish(
- &mut client_rng,
- server_registration_start_result.message,
- ClientRegistrationFinishParameters::default(),
- )
- .unwrap();
- let p_file = server_registration_start_result
- .state
- .finish(client_registration_finish_result.message)
- .unwrap();
- let client_login_start_result = ClientLogin::<Cipher>::start(
- &mut client_rng,
- b"hunter2",
- ClientLoginStartParameters::default(),
- )
- .unwrap();
- let server_login_start_result = ServerLogin::start(
- &mut server_rng,
- p_file,
- &server_kp.private(),
- client_login_start_result.message,
- ServerLoginStartParameters::default(),
- )
- .unwrap();
- assert!(
- server_login_finish_cxx(server_login_start_result.state.serialize().unwrap(), vec![])
- .is_err()
- );
- }
-}
diff --git a/native/native_rust_library/Cargo.lock b/native/native_rust_library/Cargo.lock
--- a/native/native_rust_library/Cargo.lock
+++ b/native/native_rust_library/Cargo.lock
@@ -190,6 +190,17 @@
"unicode-width",
]
+[[package]]
+name = "comm-opaque"
+version = "0.1.0"
+dependencies = [
+ "argon2",
+ "curve25519-dalek",
+ "digest 0.9.0",
+ "opaque-ke",
+ "sha2",
+]
+
[[package]]
name = "constant_time_eq"
version = "0.1.5"
@@ -651,17 +662,14 @@
name = "native_rust_library"
version = "0.1.0"
dependencies = [
- "argon2",
- "curve25519-dalek",
+ "comm-opaque",
"cxx",
"cxx-build",
- "digest 0.9.0",
"lazy_static",
"opaque-ke",
"prost",
"rand",
"regex",
- "sha2",
"tokio",
"tokio-stream",
"tonic",
diff --git a/native/native_rust_library/Cargo.toml b/native/native_rust_library/Cargo.toml
--- a/native/native_rust_library/Cargo.toml
+++ b/native/native_rust_library/Cargo.toml
@@ -16,11 +16,8 @@
rand = "0.8"
opaque-ke = "1.2"
tracing = "0.1"
-argon2 = "0.4"
-digest = "0.9"
-curve25519-dalek = "3.2"
-sha2 = "0.9"
regex = "1.6"
+comm-opaque = {path = "../../shared/comm-opaque"}
[build-dependencies]
cxx-build = "1.0"
diff --git a/native/native_rust_library/src/identity_client.rs b/native/native_rust_library/src/identity_client.rs
--- a/native/native_rust_library/src/identity_client.rs
+++ b/native/native_rust_library/src/identity_client.rs
@@ -34,7 +34,7 @@
VerifyUserTokenRequest, WalletLoginRequest as WalletLoginRequestStruct,
WalletLoginResponse as WalletLoginResponseStruct,
};
-use crate::opaque::Cipher;
+use comm_opaque::Cipher;
use crate::Client;
pub async fn get_user_id(
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -6,7 +6,6 @@
mod crypto_tools;
mod identity_client;
-mod opaque;
mod identity {
tonic::include_proto!("identity");
}
diff --git a/services/identity/Cargo.lock b/services/identity/Cargo.lock
--- a/services/identity/Cargo.lock
+++ b/services/identity/Cargo.lock
@@ -28,9 +28,9 @@
[[package]]
name = "argon2"
-version = "0.3.4"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25df3c03f1040d0069fcd3907e24e36d59f9b6fa07ba49be0eb25a794f036ba7"
+checksum = "db4ce4441f99dbd377ca8a8f57b698c44d0d6e712d8329b5040da5a64aa1ce73"
dependencies = [
"base64ct",
"blake2",
@@ -553,6 +553,17 @@
"os_str_bytes",
]
+[[package]]
+name = "comm-opaque"
+version = "0.1.0"
+dependencies = [
+ "argon2",
+ "curve25519-dalek",
+ "digest 0.9.0",
+ "opaque-ke",
+ "sha2",
+]
+
[[package]]
name = "constant_time_eq"
version = "0.1.5"
@@ -1034,22 +1045,20 @@
name = "identity"
version = "0.1.0"
dependencies = [
- "argon2",
"aws-config",
"aws-sdk-dynamodb",
"aws-types",
"bytes",
"chrono",
"clap",
+ "comm-opaque",
"constant_time_eq 0.2.2",
"curve25519-dalek",
"derive_more",
- "digest 0.9.0",
"futures-core",
"opaque-ke",
"prost",
"rand",
- "sha2",
"siwe",
"tokio",
"tokio-stream",
@@ -1311,9 +1320,9 @@
[[package]]
name = "password-hash"
-version = "0.3.2"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8"
+checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.3",
diff --git a/services/identity/Cargo.toml b/services/identity/Cargo.toml
--- a/services/identity/Cargo.toml
+++ b/services/identity/Cargo.toml
@@ -11,10 +11,7 @@
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.9"
opaque-ke = { version = "1.2.0", features = ["std"] }
-argon2 = "0.3"
curve25519-dalek = "3"
-sha2 = "0.9"
-digest = "0.9"
clap = { version = "3.1.12", features = ["derive"] }
derive_more = "0.99"
aws-config = "0.15.0"
@@ -27,6 +24,7 @@
bytes = "1.1"
constant_time_eq = "0.2.2"
siwe = "0.3"
+comm-opaque = { path = "../../shared/comm-opaque" }
[build-dependencies]
tonic-build = "0.8"
diff --git a/services/identity/Dockerfile b/services/identity/Dockerfile
--- a/services/identity/Dockerfile
+++ b/services/identity/Dockerfile
@@ -15,6 +15,7 @@
RUN cargo init --bin
COPY services/identity/Cargo.toml services/identity/Cargo.lock ./
+COPY shared/comm-opaque ../../shared/comm-opaque
# Cache build dependencies in a new layer
RUN cargo build --release
diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -25,7 +25,7 @@
USERS_TABLE_USERNAME_INDEX, USERS_TABLE_USER_PUBLIC_KEY_ATTRIBUTE,
USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE, USERS_TABLE_WALLET_ADDRESS_INDEX,
};
-use crate::opaque::Cipher;
+use comm_opaque::Cipher;
use crate::token::{AccessTokenData, AuthType};
#[derive(Clone)]
diff --git a/services/identity/src/keygen.rs b/services/identity/src/keygen.rs
--- a/services/identity/src/keygen.rs
+++ b/services/identity/src/keygen.rs
@@ -1,9 +1,8 @@
+use crate::constants::{SECRETS_FILE_EXTENSION, SECRETS_FILE_NAME};
+use comm_opaque::Cipher;
use opaque_ke::{ciphersuite::CipherSuite, rand::rngs::OsRng};
use std::{env, fs, io};
-use crate::constants::{SECRETS_FILE_EXTENSION, SECRETS_FILE_NAME};
-use crate::opaque::Cipher;
-
pub fn generate_and_persist_keypair(dir: &str) -> Result<(), io::Error> {
let mut rng = OsRng;
let server_kp = Cipher::generate_random_keypair(&mut rng);
diff --git a/services/identity/src/lib.rs b/services/identity/src/lib.rs
deleted file mode 100644
--- a/services/identity/src/lib.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-mod opaque;
-
-pub use crate::opaque::{ArgonWrapper, Cipher};
diff --git a/services/identity/src/main.rs b/services/identity/src/main.rs
--- a/services/identity/src/main.rs
+++ b/services/identity/src/main.rs
@@ -7,7 +7,6 @@
mod constants;
mod database;
mod keygen;
-mod opaque;
mod service;
mod token;
diff --git a/services/identity/src/opaque.rs b/services/identity/src/opaque.rs
deleted file mode 100644
--- a/services/identity/src/opaque.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use argon2::Argon2;
-use digest::{generic_array::GenericArray, Digest};
-use opaque_ke::{
- ciphersuite::CipherSuite, errors::InternalPakeError, hash::Hash,
- slow_hash::SlowHash,
-};
-
-pub struct Cipher;
-
-impl CipherSuite for Cipher {
- type Group = curve25519_dalek::ristretto::RistrettoPoint;
- type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDH;
- type Hash = sha2::Sha512;
- type SlowHash = ArgonWrapper;
-}
-
-pub struct ArgonWrapper(Argon2<'static>);
-
-impl<D: Hash> SlowHash<D> for ArgonWrapper {
- fn hash(
- input: GenericArray<u8, <D as Digest>::OutputSize>,
- ) -> Result<Vec<u8>, InternalPakeError> {
- let params = Argon2::default();
- let mut output = vec![0u8; <D as Digest>::output_size()];
- params
- .hash_password_into(&input, &[0; argon2::MIN_SALT_LEN], &mut output)
- .map_err(|_| InternalPakeError::SlowHashError)?;
- Ok(output)
- }
-}
diff --git a/services/identity/src/service.rs b/services/identity/src/service.rs
--- a/services/identity/src/service.rs
+++ b/services/identity/src/service.rs
@@ -16,10 +16,10 @@
use tokio_stream::{wrappers::ReceiverStream, StreamExt};
use tonic::{Request, Response, Status};
use tracing::{error, info, instrument};
+use comm_opaque::Cipher;
use crate::constants::MPSC_CHANNEL_BUFFER_CAPACITY;
use crate::database::DatabaseClient;
-use crate::opaque::Cipher;
use crate::token::{AccessTokenData, AuthType};
use crate::{config::Config, database::Error as DBError};
diff --git a/services/identity/src/users.rs b/services/identity/src/users.rs
deleted file mode 100644
diff --git a/shared/comm-opaque/.gitignore b/shared/comm-opaque/.gitignore
new file mode 100644
--- /dev/null
+++ b/shared/comm-opaque/.gitignore
@@ -0,0 +1 @@
+target
diff --git a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/Cargo.lock b/shared/comm-opaque/Cargo.lock
rename from native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/Cargo.lock
rename to shared/comm-opaque/Cargo.lock
--- a/native/cpp/CommonCpp/CryptoTools/opaque-ke-cxx/Cargo.lock
+++ b/shared/comm-opaque/Cargo.lock
@@ -4,9 +4,9 @@
[[package]]
name = "argon2"
-version = "0.3.2"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1574351abf0e4ef0de867b083a9f8e2f13618efcad6d3253c53554e4a887ed5"
+checksum = "db4ce4441f99dbd377ca8a8f57b698c44d0d6e712d8329b5040da5a64aa1ce73"
dependencies = [
"base64ct",
"blake2",
@@ -15,17 +15,17 @@
[[package]]
name = "base64ct"
-version = "1.0.1"
+version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b"
+checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf"
[[package]]
name = "blake2"
-version = "0.10.2"
+version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b94ba84325db59637ffc528bbe8c7f86c02c57cff5c0e2b9b00f9a851f42f309"
+checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e"
dependencies = [
- "digest 0.10.1",
+ "digest 0.10.6",
]
[[package]]
@@ -39,9 +39,9 @@
[[package]]
name = "block-buffer"
-version = "0.10.0"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95"
+checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [
"generic-array",
]
@@ -52,12 +52,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
-[[package]]
-name = "cc"
-version = "1.0.72"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
-
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -65,13 +59,14 @@
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
-name = "codespan-reporting"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
+name = "comm-opaque"
+version = "0.1.0"
dependencies = [
- "termcolor",
- "unicode-width",
+ "argon2",
+ "curve25519-dalek",
+ "digest 0.9.0",
+ "opaque-ke",
+ "sha2",
]
[[package]]
@@ -82,20 +77,21 @@
[[package]]
name = "cpufeatures"
-version = "0.2.1"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
+checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]]
name = "crypto-common"
-version = "0.1.1"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
+ "typenum",
]
[[package]]
@@ -110,9 +106,9 @@
[[package]]
name = "curve25519-dalek"
-version = "3.2.0"
+version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
+checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0"
dependencies = [
"byteorder",
"digest 0.9.0",
@@ -121,50 +117,6 @@
"zeroize",
]
-[[package]]
-name = "cxx"
-version = "1.0.63"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c949f4e2576a655698463c56dbc5c5ea4c00964becc9adb0458baa943e862a5b"
-dependencies = [
- "cc",
- "cxxbridge-flags",
- "cxxbridge-macro",
- "link-cplusplus",
-]
-
-[[package]]
-name = "cxx-build"
-version = "1.0.63"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "618f85c8f132bd8912aab124e15a38adc762bb7e3cef84524adde1692ef3e8bc"
-dependencies = [
- "cc",
- "codespan-reporting",
- "once_cell",
- "proc-macro2",
- "quote",
- "scratch",
- "syn",
-]
-
-[[package]]
-name = "cxxbridge-flags"
-version = "1.0.63"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b44dad556b0c83d86676135d6c684bdc2b1b9a1188052dd1cb5998246163536"
-
-[[package]]
-name = "cxxbridge-macro"
-version = "1.0.63"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2acc9305a8b69bc2308c2e17dbb98debeac984cdc89ac550c01507cc129433c3"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
[[package]]
name = "digest"
version = "0.9.0"
@@ -176,13 +128,12 @@
[[package]]
name = "digest"
-version = "0.10.1"
+version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b"
+checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
- "block-buffer 0.10.0",
+ "block-buffer 0.10.3",
"crypto-common",
- "generic-array",
"subtle",
]
@@ -199,9 +150,9 @@
[[package]]
name = "generic-array"
-version = "0.14.5"
+version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
+checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"typenum",
"version_check",
@@ -215,18 +166,7 @@
dependencies = [
"cfg-if",
"libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
-[[package]]
-name = "getrandom"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
-dependencies = [
- "cfg-if",
- "libc",
- "wasi 0.10.2+wasi-snapshot-preview1",
+ "wasi",
]
[[package]]
@@ -251,24 +191,9 @@
[[package]]
name = "libc"
-version = "0.2.112"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
-
-[[package]]
-name = "link-cplusplus"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8cae2cd7ba2f3f63938b9c724475dfb7b9861b545a90324476324ed21dbc8c8"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.9.0"
+version = "0.2.138"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
+checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]]
name = "opaque-debug"
@@ -294,75 +219,42 @@
"zeroize",
]
-[[package]]
-name = "opaque-ke-cxx"
-version = "0.1.0"
-dependencies = [
- "argon2",
- "curve25519-dalek",
- "cxx",
- "cxx-build",
- "digest 0.9.0",
- "opaque-ke",
- "rand",
- "sha2",
-]
-
[[package]]
name = "password-hash"
-version = "0.3.2"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8"
+checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
- "rand_core 0.6.3",
+ "rand_core 0.6.4",
"subtle",
]
-[[package]]
-name = "ppv-lite86"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
-
[[package]]
name = "proc-macro2"
-version = "1.0.36"
+version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
+checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
dependencies = [
- "unicode-xid",
+ "unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.14"
+version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
+checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
-dependencies = [
- "libc",
- "rand_chacha",
- "rand_core 0.6.3",
- "rand_hc",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.3.1"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
- "ppv-lite86",
- "rand_core 0.6.3",
+ "rand_core 0.6.4",
]
[[package]]
@@ -371,32 +263,14 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
- "getrandom 0.1.16",
+ "getrandom",
]
[[package]]
name = "rand_core"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
-dependencies = [
- "getrandom 0.2.4",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
-dependencies = [
- "rand_core 0.6.3",
-]
-
-[[package]]
-name = "scratch"
-version = "1.0.1"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96311ef4a16462c757bb6a39152c40f58f31cd2602a40fceb937e2bc34e6cbab"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "sha2"
@@ -419,13 +293,13 @@
[[package]]
name = "syn"
-version = "1.0.85"
+version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
+checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
dependencies = [
"proc-macro2",
"quote",
- "unicode-xid",
+ "unicode-ident",
]
[[package]]
@@ -440,32 +314,23 @@
"unicode-xid",
]
-[[package]]
-name = "termcolor"
-version = "1.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
-dependencies = [
- "winapi-util",
-]
-
[[package]]
name = "typenum"
-version = "1.15.0"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
+checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
-name = "unicode-width"
-version = "0.1.9"
+name = "unicode-ident"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
+checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
[[package]]
name = "unicode-xid"
-version = "0.2.2"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "version_check"
@@ -479,57 +344,20 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-[[package]]
-name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
[[package]]
name = "zeroize"
-version = "1.5.0"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc222aec311c323c717f56060324f32b82da1ce1dd81d9a09aa6a9030bfe08db"
+checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
-version = "1.3.1"
+version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81e8f13fef10b63c06356d65d416b070798ddabcadc10d3ece0c5be9b3c7eddb"
+checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c"
dependencies = [
"proc-macro2",
"quote",
diff --git a/shared/comm-opaque/Cargo.toml b/shared/comm-opaque/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/shared/comm-opaque/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "comm-opaque"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+argon2 = "0.4"
+opaque-ke = "1.2"
+digest = "0.9"
+curve25519-dalek = "3.2"
+sha2 = "0.9"
\ No newline at end of file
diff --git a/shared/comm-opaque/src/lib.rs b/shared/comm-opaque/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/shared/comm-opaque/src/lib.rs
@@ -0,0 +1,2 @@
+mod opaque;
+pub use crate::opaque::Cipher;
diff --git a/native/native_rust_library/src/opaque.rs b/shared/comm-opaque/src/opaque.rs
rename from native/native_rust_library/src/opaque.rs
rename to shared/comm-opaque/src/opaque.rs
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 8:19 PM (13 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678766
Default Alt Text
D5880.id19893.diff (51 KB)
Attached To
Mode
D5880: clean up the repo a bit
Attached
Detach File
Event Timeline
Log In to Comment