Skip to content

Commit

Permalink
Add test for expired CRL
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperpatterson authored and cpu committed May 16, 2024
1 parent f05e85b commit 91a157c
Show file tree
Hide file tree
Showing 73 changed files with 208 additions and 3 deletions.
104 changes: 104 additions & 0 deletions tests/client_auth_revocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,3 +1547,107 @@ fn ee_dp_invalid_owned() {
Err(webpki::Error::UnknownRevocationStatus)
);
}

#[test]
fn expired_crl_ignore_expiration() {
let ee = include_bytes!("client_auth_revocation/no_ku_chain.ee.der");
let intermediates = &[
include_bytes!("client_auth_revocation/no_ku_chain.int.a.ca.der").as_slice(),
include_bytes!("client_auth_revocation/no_ku_chain.int.b.ca.der").as_slice(),
];
let ca = include_bytes!("client_auth_revocation/no_ku_chain.root.ca.der");

let crls = &[&webpki::CertRevocationList::Borrowed(
webpki::BorrowedCertRevocationList::from_der(
include_bytes!("client_auth_revocation/expired_crl_ignore_expiration.crl.der")
.as_slice(),
)
.unwrap(),
)];
let builder = RevocationOptionsBuilder::new(crls).unwrap();

let builder = builder.with_status_policy(UnknownStatusPolicy::Allow);
let revocation = Some(builder.build());
assert_eq!(check_cert(ee, intermediates, ca, revocation), Ok(()));
}

#[cfg(feature = "alloc")]
#[test]
fn expired_crl_ignore_expiration_owned() {
let ee = include_bytes!("client_auth_revocation/no_ku_chain.ee.der");
let intermediates = &[
include_bytes!("client_auth_revocation/no_ku_chain.int.a.ca.der").as_slice(),
include_bytes!("client_auth_revocation/no_ku_chain.int.b.ca.der").as_slice(),
];
let ca = include_bytes!("client_auth_revocation/no_ku_chain.root.ca.der");

let crls = &[&webpki::CertRevocationList::Owned(
webpki::OwnedCertRevocationList::from_der(
include_bytes!("client_auth_revocation/expired_crl_ignore_expiration.crl.der")
.as_slice(),
)
.unwrap(),
)];
let builder = RevocationOptionsBuilder::new(crls).unwrap();

let builder = builder.with_status_policy(UnknownStatusPolicy::Allow);
let revocation = Some(builder.build());
assert_eq!(check_cert(ee, intermediates, ca, revocation), Ok(()));
}

#[test]
fn expired_crl_enforce_expiration() {
let ee = include_bytes!("client_auth_revocation/no_ku_chain.ee.der");
let intermediates = &[
include_bytes!("client_auth_revocation/no_ku_chain.int.a.ca.der").as_slice(),
include_bytes!("client_auth_revocation/no_ku_chain.int.b.ca.der").as_slice(),
];
let ca = include_bytes!("client_auth_revocation/no_ku_chain.root.ca.der");

let crls = &[&webpki::CertRevocationList::Borrowed(
webpki::BorrowedCertRevocationList::from_der(
include_bytes!("client_auth_revocation/expired_crl_enforce_expiration.crl.der")
.as_slice(),
)
.unwrap(),
)];
let builder = RevocationOptionsBuilder::new(crls).unwrap();

let builder = builder.with_status_policy(UnknownStatusPolicy::Allow);

let builder = builder.with_expiration_policy(webpki::ExpirationPolicy::Enforce);
let revocation = Some(builder.build());
assert_eq!(
check_cert(ee, intermediates, ca, revocation),
Err(webpki::Error::CrlExpired)
);
}

#[cfg(feature = "alloc")]
#[test]
fn expired_crl_enforce_expiration_owned() {
let ee = include_bytes!("client_auth_revocation/no_ku_chain.ee.der");
let intermediates = &[
include_bytes!("client_auth_revocation/no_ku_chain.int.a.ca.der").as_slice(),
include_bytes!("client_auth_revocation/no_ku_chain.int.b.ca.der").as_slice(),
];
let ca = include_bytes!("client_auth_revocation/no_ku_chain.root.ca.der");

let crls = &[&webpki::CertRevocationList::Owned(
webpki::OwnedCertRevocationList::from_der(
include_bytes!("client_auth_revocation/expired_crl_enforce_expiration.crl.der")
.as_slice(),
)
.unwrap(),
)];
let builder = RevocationOptionsBuilder::new(crls).unwrap();

let builder = builder.with_status_policy(UnknownStatusPolicy::Allow);

let builder = builder.with_expiration_policy(webpki::ExpirationPolicy::Enforce);
let revocation = Some(builder.build());
assert_eq!(
check_cert(ee, intermediates, ca, revocation),
Err(webpki::Error::CrlExpired)
);
}
Binary file modified tests/client_auth_revocation/dp_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/dp_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/dp_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/dp_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/dp_chain.topbit.ee.der
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_dp_idp_match.crl.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_dp_invalid.crl.der
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_no_dp_crl_idp.crl.der
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_not_revoked_chain_depth.crl.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_not_revoked_ee_depth.crl.der
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_revoked_badsig_ee_depth.crl.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_revoked_chain_depth.crl.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_revoked_crl_ku_ee_depth.crl.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ee_revoked_no_ku_ee_depth.crl.der
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/indirect_dp_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/indirect_dp_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/indirect_dp_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/indirect_dp_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/indirect_dp_chain.topbit.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/int_not_revoked_chain_depth.crl.der
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/invalid_dp_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/invalid_dp_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/invalid_dp_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/invalid_dp_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/invalid_dp_chain.topbit.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ku_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ku_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ku_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ku_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/ku_chain.topbit.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_crl_ku_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_crl_ku_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_crl_ku_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_crl_ku_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_crl_ku_chain.topbit.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_ku_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_ku_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_ku_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_ku_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/no_ku_chain.topbit.ee.der
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/client_auth_revocation/nofullname_dp_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/nofullname_dp_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/nofullname_dp_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/nofullname_dp_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/nofullname_dp_chain.topbit.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/reasons_dp_chain.ee.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/reasons_dp_chain.int.a.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/reasons_dp_chain.int.b.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/reasons_dp_chain.root.ca.der
Binary file not shown.
Binary file modified tests/client_auth_revocation/reasons_dp_chain.topbit.ee.der
Binary file not shown.
Loading

0 comments on commit 91a157c

Please sign in to comment.