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

X509CrlRef::get_by_cert(): support passing of cert by non-owned ref… #2207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion openssl/src/x509/mod.rs
Expand Up @@ -1910,7 +1910,7 @@ impl X509CrlRef {

/// Get the revocation status of a certificate
#[corresponds(X509_CRL_get0_by_cert)]
pub fn get_by_cert<'a>(&'a self, cert: &X509) -> CrlStatus<'a> {
pub fn get_by_cert<'a>(&'a self, cert: &X509Ref) -> CrlStatus<'a> {
unsafe {
let mut ret = ptr::null_mut::<ffi::X509_REVOKED>();
let status =
Expand Down
11 changes: 11 additions & 0 deletions openssl/src/x509/tests.rs
Expand Up @@ -694,6 +694,17 @@ fn test_load_crl() {
cert.serial_number().to_bn().unwrap(),
"revoked and cert serial numbers should match"
);

let revoked = match crl.get_by_cert(cert.as_ref()) {
CrlStatus::Revoked(revoked) => revoked,
_ => panic!("cert should be revoked"),
};

assert_eq!(
revoked.serial_number().to_bn().unwrap(),
cert.serial_number().to_bn().unwrap(),
"revoked and cert serial numbers should match"
);
}

#[test]
Expand Down