From 5a1aaa443a87a1e2be1290f7cec50bb708dd8287 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Mon, 24 Jun 2019 19:02:02 +0200 Subject: [PATCH] Update the tests --- acmed/src/acme_proto/jws.rs | 12 ++++++------ acmed/src/acme_proto/jws/algorithms.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/acmed/src/acme_proto/jws.rs b/acmed/src/acme_proto/jws.rs index 057473a..1928741 100644 --- a/acmed/src/acme_proto/jws.rs +++ b/acmed/src/acme_proto/jws.rs @@ -88,10 +88,10 @@ mod tests { #[test] fn test_default_jwk() { - let (_, priv_key) = gen_keypair(KeyType::EcdsaP256).unwrap(); + let key_pair = gen_keypair(KeyType::EcdsaP256).unwrap(); let payload = "Dummy payload 1"; let payload_b64 = "RHVtbXkgcGF5bG9hZCAx"; - let s = encode_jwk(&priv_key, payload.as_bytes(), "", ""); + let s = encode_jwk(&key_pair, payload.as_bytes(), "", ""); assert!(s.is_ok()); let s = s.unwrap(); assert!(s.contains("\"protected\"")); @@ -102,11 +102,11 @@ mod tests { #[test] fn test_default_nopad_jwk() { - let (_, priv_key) = gen_keypair(KeyType::EcdsaP256).unwrap(); + let key_pair = gen_keypair(KeyType::EcdsaP256).unwrap(); let payload = "Dummy payload"; let payload_b64 = "RHVtbXkgcGF5bG9hZA"; let payload_b64_pad = "RHVtbXkgcGF5bG9hZA=="; - let s = encode_jwk(&priv_key, payload.as_bytes(), "", ""); + let s = encode_jwk(&key_pair, payload.as_bytes(), "", ""); assert!(s.is_ok()); let s = s.unwrap(); assert!(s.contains("\"protected\"")); @@ -118,11 +118,11 @@ mod tests { #[test] fn test_default_kid() { - let (_, priv_key) = gen_keypair(KeyType::EcdsaP256).unwrap(); + let key_pair = gen_keypair(KeyType::EcdsaP256).unwrap(); let payload = "Dummy payload 1"; let payload_b64 = "RHVtbXkgcGF5bG9hZCAx"; let key_id = "0x2a"; - let s = encode_kid(&priv_key, key_id, payload.as_bytes(), "", ""); + let s = encode_kid(&key_pair, key_id, payload.as_bytes(), "", ""); assert!(s.is_ok()); let s = s.unwrap(); assert!(s.contains("\"protected\"")); diff --git a/acmed/src/acme_proto/jws/algorithms.rs b/acmed/src/acme_proto/jws/algorithms.rs index 6f7c471..78c20ab 100644 --- a/acmed/src/acme_proto/jws/algorithms.rs +++ b/acmed/src/acme_proto/jws/algorithms.rs @@ -71,7 +71,7 @@ impl SignatureAlgorithm { #[cfg(test)] mod tests { use super::{EdDsaVariant, SignatureAlgorithm}; - use acme_common::crypto::PrivateKey; + use acme_common::crypto::KeyPair; use std::str::FromStr; #[test] @@ -115,7 +115,7 @@ MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg6To1BW8qTehGhPca 0eMcW8iQU4yA02dvtKkuqfny4HChRANCAAQwxx+j3wYGzD5LSFNBTLlT7J+7rWrq 4BGdR8705iwpBeOQgMpLj+9vuFutlVtmoYpJSYa9+49Hxz8aCe1AQeWt -----END PRIVATE KEY-----"; - let k = PrivateKey::from_pem(pem).unwrap(); + let k = KeyPair::from_pem(pem).unwrap(); let s = SignatureAlgorithm::from_pkey(&k); assert!(s.is_ok()); let s = s.unwrap();