Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to pki-types 0.2.1 #48

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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