From a16441b24dd3cc85c2d7b11131c49128c6415f71 Mon Sep 17 00:00:00 2001 From: Joseph Birr-Pixton Date: Mon, 18 Sep 2023 12:15:03 +0100 Subject: [PATCH] Move to pki-types 0.2.1 --- Cargo.toml | 2 +- tests/verify.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2a841f4..ad37f0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,6 @@ ring = "0.16.20" rustls-pemfile = "1" serde = { version = "1.0.183", features = ["derive"] } tokio = { version = "1", features = ["macros", "rt-multi-thread"] } -webpki = { package = "rustls-webpki", version = "0.102.0-alpha.2" } +webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.3" } x509-parser = "0.15.1" yasna = "0.5.2" diff --git a/tests/verify.rs b/tests/verify.rs index 5f24ba3..353a4fe 100644 --- a/tests/verify.rs +++ b/tests/verify.rs @@ -1,8 +1,9 @@ +use core::time::Duration; use std::convert::TryFrom; -use pki_types::{CertificateDer, SignatureVerificationAlgorithm}; +use pki_types::{CertificateDer, SignatureVerificationAlgorithm, UnixTime}; use rcgen::{BasicConstraints, Certificate, CertificateParams, DnType, IsCa, KeyUsagePurpose}; -use webpki::{extract_trust_anchor, EndEntityCert, Error, KeyUsage, SubjectNameRef, Time}; +use webpki::{extract_trust_anchor, EndEntityCert, Error, KeyUsage, SubjectNameRef}; use x509_parser::extensions::{GeneralName, NameConstraints as X509ParserNameConstraints}; use x509_parser::prelude::FromDer; @@ -14,7 +15,7 @@ fn name_constraints() { .iter() .filter_map(|ta| ta.name_constraints.as_ref()) { - let time = Time::from_seconds_since_unix_epoch(0x40000000); // Time matching rcgen default. + let time = UnixTime::since_unix_epoch(Duration::from_secs(0x40000000)); // Time matching rcgen default. let test_case = ConstraintTest::new(name_constraints.as_ref()); let trust_anchors = &[extract_trust_anchor(&test_case.trust_anchor).unwrap()]; @@ -164,7 +165,7 @@ fn tubitak_name_constraint_works() { let subj = CertificateDer::from(&include_bytes!("data/tubitak/subj.der")[..]); let roots = [extract_trust_anchor(&root).unwrap().to_owned()]; - let now = Time::from_seconds_since_unix_epoch(1493668479); + let now = UnixTime::since_unix_epoch(Duration::from_secs(1493668479)); let cert = EndEntityCert::try_from(&subj).unwrap(); cert.verify_for_usage( ALL_ALGORITHMS,