Enforce public vs private keys via types

This commit is contained in:
Valentin Tolmer
2021-06-15 14:47:35 -07:00
committed by Kevin Lewi
parent cd85efc603
commit 210e0e99df
8 changed files with 139 additions and 77 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ use crate::{
errors::*,
group::Group,
key_exchange::tripledh::{NonceLen, TripleDH},
keypair::{Key, SizedBytesExt},
keypair::{PrivateKey, PublicKey, SizedBytesExt},
opaque::*,
slow_hash::NoOpHash,
tests::mock_rng::CycleRng,
@@ -494,7 +494,7 @@ fn test_registration_response() -> Result<(), ProtocolError> {
ServerRegistration::<RistrettoSha5123dhNoSlowHash>::start(
&mut oprf_key_rng,
RegistrationRequest::deserialize(&parameters.registration_request[..])?,
&Key::from_bytes(&parameters.server_s_pk[..])?,
&PublicKey::from_bytes(&parameters.server_s_pk[..])?,
)?;
assert_eq!(
hex::encode(parameters.registration_response),
@@ -589,7 +589,7 @@ fn test_credential_response() -> Result<(), ProtocolError> {
let server_login_start_result = ServerLogin::<RistrettoSha5123dhNoSlowHash>::start(
&mut server_e_sk_and_nonce_rng,
ServerRegistration::deserialize(&parameters.password_file[..])?,
&Key::from_bytes(&parameters.server_s_sk[..])?,
&PrivateKey::from_bytes(&parameters.server_s_sk[..])?,
CredentialRequest::<RistrettoSha5123dhNoSlowHash>::deserialize(
&parameters.credential_request[..],
)?,