aboutsummaryrefslogtreecommitdiff
path: root/openssl
diff options
context:
space:
mode:
authorLionel Flandrin <[email protected]>2016-10-31 23:55:00 +0100
committerLionel Flandrin <[email protected]>2016-11-01 21:23:18 +0100
commit8d0090faecea5dbcbf87a0446beb2e60828378bc (patch)
treeefa605236cbd01e524d4269c66858546cf8cdb21 /openssl
parentReplace GeneralNames by the new Stack API (diff)
downloadrust-openssl-8d0090faecea5dbcbf87a0446beb2e60828378bc.tar.xz
rust-openssl-8d0090faecea5dbcbf87a0446beb2e60828378bc.zip
Implement X509StoreContextRef::get_chain
Diffstat (limited to 'openssl')
-rw-r--r--openssl/src/x509/mod.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index dcda5913..e27b03d1 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -67,6 +67,28 @@ impl Ref<X509StoreContext> {
pub fn error_depth(&self) -> u32 {
unsafe { ffi::X509_STORE_CTX_get_error_depth(self.as_ptr()) as u32 }
}
+
+ pub fn get_chain(&self) -> Option<&Ref<Stack<X509>>> {
+ unsafe {
+ let chain = self._get_chain();
+
+ if chain.is_null() {
+ return None;
+ }
+
+ Some(Ref::from_ptr(chain))
+ }
+ }
+
+ #[cfg(ossl110)]
+ unsafe fn _get_chain(&self) -> *mut ffi::stack_st_X509 {
+ ffi::X509_STORE_CTX_get0_chain(self.as_ptr())
+ }
+
+ #[cfg(ossl10x)]
+ unsafe fn _get_chain(&self) -> *mut ffi::stack_st_X509 {
+ ffi::X509_STORE_CTX_get_chain(self.as_ptr())
+ }
}
#[allow(non_snake_case)]
@@ -468,6 +490,10 @@ impl Borrow<Ref<X509>> for X509 {
&*self
}
}
+
+impl Stackable for X509 {
+ type StackType = ffi::stack_st_X509;
+}
type_!(X509Name, ffi::X509_NAME, ffi::X509_NAME_free);