diff options
| author | Steven Fackler <[email protected]> | 2016-11-12 00:24:12 +0000 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-11-12 00:24:12 +0000 |
| commit | 26a3358a2b70b46bf06403b2810c379f5299a551 (patch) | |
| tree | 40efb4305948a67660bd6bcdbdf12d25d3871945 /openssl/src/ssl/mod.rs | |
| parent | Consistently support both PEM and DER encodings (diff) | |
| download | rust-openssl-26a3358a2b70b46bf06403b2810c379f5299a551.tar.xz rust-openssl-26a3358a2b70b46bf06403b2810c379f5299a551.zip | |
Add basic X509_STORE access
There's more to do here, but this enabled addition of trusted CAs from
X509 objects.
Closes #394
Diffstat (limited to 'openssl/src/ssl/mod.rs')
| -rw-r--r-- | openssl/src/ssl/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index c92bf56b..1e0d2e66 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -94,6 +94,7 @@ use {init, cvt, cvt_p}; use dh::DhRef; use ec_key::EcKeyRef; use x509::{X509StoreContextRef, X509FileType, X509, X509Ref, X509VerifyError, X509Name}; +use x509::store::X509StoreBuilderRef; #[cfg(any(ossl102, ossl110))] use verify::X509VerifyParamRef; use pkey::PKeyRef; @@ -739,6 +740,16 @@ impl SslContextBuilder { unsafe { cvt(ffi::SSL_CTX_check_private_key(self.as_ptr())).map(|_| ()) } } + /// Returns a shared reference to the context's certificate store. + pub fn cert_store(&self) -> &X509StoreBuilderRef { + unsafe { X509StoreBuilderRef::from_ptr(ffi::SSL_CTX_get_cert_store(self.as_ptr())) } + } + + /// Returns a mutable reference to the context's certificate store. + pub fn cert_store_mut(&mut self) -> &mut X509StoreBuilderRef { + unsafe { X509StoreBuilderRef::from_ptr_mut(ffi::SSL_CTX_get_cert_store(self.as_ptr())) } + } + pub fn build(self) -> SslContext { let ctx = SslContext(self.0); mem::forget(self); |