From 7292cc68ca13bd61e8152740e1b5ba3a9578ef90 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Wed, 26 Aug 2020 16:12:18 +0200 Subject: [PATCH] Fix the certificate generation tests --- acme_common/src/tests/certificate.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/acme_common/src/tests/certificate.rs b/acme_common/src/tests/certificate.rs index 328f4e2..d43bf5c 100644 --- a/acme_common/src/tests/certificate.rs +++ b/acme_common/src/tests/certificate.rs @@ -1,4 +1,4 @@ -use crate::crypto::{KeyType, X509Certificate}; +use crate::crypto::{HashFunction, KeyType, X509Certificate}; use std::collections::HashSet; use std::iter::FromIterator; @@ -85,38 +85,50 @@ fn test_san_domains_and_ip() { #[test] fn generate_rsa2048_certificate() { - let (kp, _) = X509Certificate::from_acme_ext("example.org", "", KeyType::Rsa2048).unwrap(); + let (kp, _) = + X509Certificate::from_acme_ext("example.org", "", KeyType::Rsa2048, HashFunction::Sha256) + .unwrap(); assert_eq!(kp.key_type, KeyType::Rsa2048); } #[test] fn generate_rsa4096_certificate() { - let (kp, _) = X509Certificate::from_acme_ext("example.org", "", KeyType::Rsa4096).unwrap(); + let (kp, _) = + X509Certificate::from_acme_ext("example.org", "", KeyType::Rsa4096, HashFunction::Sha256) + .unwrap(); assert_eq!(kp.key_type, KeyType::Rsa4096); } #[test] fn generate_ecdsa_p256_certificate() { - let (kp, _) = X509Certificate::from_acme_ext("example.org", "", KeyType::EcdsaP256).unwrap(); + let (kp, _) = + X509Certificate::from_acme_ext("example.org", "", KeyType::EcdsaP256, HashFunction::Sha256) + .unwrap(); assert_eq!(kp.key_type, KeyType::EcdsaP256); } #[test] fn generate_ecdsa_p384_certificate() { - let (kp, _) = X509Certificate::from_acme_ext("example.org", "", KeyType::EcdsaP384).unwrap(); + let (kp, _) = + X509Certificate::from_acme_ext("example.org", "", KeyType::EcdsaP384, HashFunction::Sha256) + .unwrap(); assert_eq!(kp.key_type, KeyType::EcdsaP384); } #[cfg(ed25519)] #[test] fn generate_ed25519_certificate() { - let (kp, _) = X509Certificate::from_acme_ext("example.org", "", KeyType::Ed25519).unwrap(); + let (kp, _) = + X509Certificate::from_acme_ext("example.org", "", KeyType::Ed25519, HashFunction::Sha256) + .unwrap(); assert_eq!(kp.key_type, KeyType::Ed25519); } #[cfg(ed448)] #[test] fn generate_ed448_certificate() { - let (kp, _) = X509Certificate::from_acme_ext("example.org", "", KeyType::Ed448).unwrap(); + let (kp, _) = + X509Certificate::from_acme_ext("example.org", "", KeyType::Ed448, HashFunction::Sha256) + .unwrap(); assert_eq!(kp.key_type, KeyType::Ed448); }