aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-07-29 10:34:10 -0700
committerSteven Fackler <[email protected]>2017-07-29 10:34:10 -0700
commitc2164a4864dd19d8975c21b6ad954ebd99724e8c (patch)
treecb03c571d0e778a48114b896f3141b253e04dea6 /openssl/src/ssl
parentIgnore dtls tests (diff)
downloadrust-openssl-c2164a4864dd19d8975c21b6ad954ebd99724e8c.tar.xz
rust-openssl-c2164a4864dd19d8975c21b6ad954ebd99724e8c.zip
Add peer_cert_chain
Diffstat (limited to 'openssl/src/ssl')
-rw-r--r--openssl/src/ssl/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 9e17ae60..dc0f5448 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -1257,6 +1257,21 @@ impl SslRef {
}
}
+ /// Returns the certificate chain of the peer, if present.
+ ///
+ /// On the client side, the chain includes the leaf certificate, but on the server side it does
+ /// not. Fun!
+ pub fn peer_cert_chain(&self) -> Option<&StackRef<X509>> {
+ unsafe {
+ let ptr = ffi::SSL_get_peer_cert_chain(self.as_ptr());
+ if ptr.is_null() {
+ None
+ } else {
+ Some(StackRef::from_ptr(ptr))
+ }
+ }
+ }
+
/// Returns the certificate associated with this `Ssl`, if present.
pub fn certificate(&self) -> Option<&X509Ref> {
unsafe {