aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/x509
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-11-06 12:16:44 -0800
committerSteven Fackler <[email protected]>2016-11-06 12:17:14 -0800
commit1edb6f682eaa728871e39aa41735a668fcc7447c (patch)
treee58e5412091483a332c6552290d8fbf2076e532d /openssl/src/x509
parentFix build on 1.0.1 (diff)
downloadrust-openssl-1edb6f682eaa728871e39aa41735a668fcc7447c.tar.xz
rust-openssl-1edb6f682eaa728871e39aa41735a668fcc7447c.zip
Support client CA advertisement
Diffstat (limited to 'openssl/src/x509')
-rw-r--r--openssl/src/x509/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index eb517f80..e98e6006 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -6,6 +6,7 @@ use std::error::Error;
use std::ffi::{CStr, CString};
use std::fmt;
use std::mem;
+use std::path::Path;
use std::ptr;
use std::slice;
use std::str;
@@ -498,6 +499,22 @@ impl Stackable for X509 {
type_!(X509Name, X509NameRef, ffi::X509_NAME, ffi::X509_NAME_free);
+impl X509Name {
+ /// Loads subject names from a file containing PEM-formatted certificates.
+ ///
+ /// This is commonly used in conjunction with `SslContextBuilder::set_client_ca_list`.
+ pub fn load_client_ca_file<P: AsRef<Path>>(file: P) -> Result<Stack<X509Name>, ErrorStack> {
+ let file = CString::new(file.as_ref().as_os_str().to_str().unwrap()).unwrap();
+ unsafe {
+ cvt_p(ffi::SSL_load_client_CA_file(file.as_ptr())).map(|p| Stack::from_ptr(p))
+ }
+ }
+}
+
+impl Stackable for X509Name {
+ type StackType = ffi::stack_st_X509_NAME;
+}
+
impl X509NameRef {
pub fn entries_by_nid<'a>(&'a self, nid: Nid) -> X509NameEntries<'a> {
X509NameEntries {