diff options
| author | Jethro Beekman <[email protected]> | 2015-07-08 13:37:35 -0700 |
|---|---|---|
| committer | Jethro Beekman <[email protected]> | 2015-07-08 13:37:35 -0700 |
| commit | 90dd54b541cb632ca450e68c88c9f36068a559d5 (patch) | |
| tree | 9a9350e13f4910ed0de81cfe3db2e381a986668f /openssl/src/x509/mod.rs | |
| parent | Merge pull request #239 from jethrogb/topic/x509_extension_fix (diff) | |
| download | rust-openssl-90dd54b541cb632ca450e68c88c9f36068a559d5.tar.xz rust-openssl-90dd54b541cb632ca450e68c88c9f36068a559d5.zip | |
Implement certificate extensions for certificate requests
Diffstat (limited to 'openssl/src/x509/mod.rs')
| -rw-r--r-- | openssl/src/x509/mod.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index a5df80f5..91daa66a 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -396,11 +396,20 @@ impl X509Generator { Err(x) => return Err(x) }; - let hash_fn = self.hash_type.evp_md(); - let req = unsafe { ffi::X509_to_X509_REQ(cert.handle, p_key.get_handle(), hash_fn) }; - try_ssl_null!(req); + unsafe { + let req = ffi::X509_to_X509_REQ(cert.handle, ptr::null_mut(), ptr::null()); + try_ssl_null!(req); + + let exts = ffi::X509_get_extensions(cert.handle); + if exts != ptr::null_mut() { + try_ssl!(ffi::X509_REQ_add_extensions(req,exts)); + } - Ok(X509Req::new(req)) + let hash_fn = self.hash_type.evp_md(); + try_ssl!(ffi::X509_REQ_sign(req, p_key.get_handle(), hash_fn)); + + Ok(X509Req::new(req)) + } } } |