Loading openssl-sys/src/handwritten/x509v3.rs +2 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,8 @@ extern "C" { indent: c_int, ) -> c_int; #[cfg(ossl110)] pub fn X509_get_pathlen(x: *mut X509) -> c_long; #[cfg(ossl110)] pub fn X509_get_extension_flags(x: *mut X509) -> u32; #[cfg(ossl110)] Loading openssl/src/x509/mod.rs +8 −0 Original line number Diff line number Diff line Loading @@ -483,6 +483,14 @@ impl X509Ref { } } /// Retrieves the path length extension from a certificate, if it exists. #[corresponds(X509_get_pathlen)] #[cfg(ossl110)] pub fn pathlen(&self) -> Option<u32> { let v = unsafe { ffi::X509_get_pathlen(self.as_ptr()) }; u32::try_from(v).ok() } /// Returns this certificate's subject key id, if it exists. #[corresponds(X509_get0_subject_key_id)] #[cfg(ossl110)] Loading openssl/src/x509/tests.rs +16 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,22 @@ fn test_subject_alt_name() { assert_eq!(Some("http://www.example.com"), subject_alt_names[4].uri()); } #[test] #[cfg(ossl110)] fn test_retrieve_pathlen() { let cert = include_bytes!("../../test/root-ca.pem"); let cert = X509::from_pem(cert).unwrap(); assert_eq!(cert.pathlen(), None); let cert = include_bytes!("../../test/intermediate-ca.pem"); let cert = X509::from_pem(cert).unwrap(); assert_eq!(cert.pathlen(), Some(0)); let cert = include_bytes!("../../test/alt_name_cert.pem"); let cert = X509::from_pem(cert).unwrap(); assert_eq!(cert.pathlen(), None); } #[test] #[cfg(ossl110)] fn test_subject_key_id() { Loading Loading
openssl-sys/src/handwritten/x509v3.rs +2 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,8 @@ extern "C" { indent: c_int, ) -> c_int; #[cfg(ossl110)] pub fn X509_get_pathlen(x: *mut X509) -> c_long; #[cfg(ossl110)] pub fn X509_get_extension_flags(x: *mut X509) -> u32; #[cfg(ossl110)] Loading
openssl/src/x509/mod.rs +8 −0 Original line number Diff line number Diff line Loading @@ -483,6 +483,14 @@ impl X509Ref { } } /// Retrieves the path length extension from a certificate, if it exists. #[corresponds(X509_get_pathlen)] #[cfg(ossl110)] pub fn pathlen(&self) -> Option<u32> { let v = unsafe { ffi::X509_get_pathlen(self.as_ptr()) }; u32::try_from(v).ok() } /// Returns this certificate's subject key id, if it exists. #[corresponds(X509_get0_subject_key_id)] #[cfg(ossl110)] Loading
openssl/src/x509/tests.rs +16 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,22 @@ fn test_subject_alt_name() { assert_eq!(Some("http://www.example.com"), subject_alt_names[4].uri()); } #[test] #[cfg(ossl110)] fn test_retrieve_pathlen() { let cert = include_bytes!("../../test/root-ca.pem"); let cert = X509::from_pem(cert).unwrap(); assert_eq!(cert.pathlen(), None); let cert = include_bytes!("../../test/intermediate-ca.pem"); let cert = X509::from_pem(cert).unwrap(); assert_eq!(cert.pathlen(), Some(0)); let cert = include_bytes!("../../test/alt_name_cert.pem"); let cert = X509::from_pem(cert).unwrap(); assert_eq!(cert.pathlen(), None); } #[test] #[cfg(ossl110)] fn test_subject_key_id() { Loading