Skip to content

Commit

Permalink
Move to pki-types 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz committed Sep 18, 2023
1 parent fbd1b0e commit a16441b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
9 changes: 5 additions & 4 deletions tests/verify.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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()];

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a16441b

Please sign in to comment.