diff options
| author | mredlek <[email protected]> | 2017-01-26 20:59:32 +0100 |
|---|---|---|
| committer | mredlek <[email protected]> | 2017-01-26 21:05:33 +0100 |
| commit | 557b936e27177718b62d31dcf3364f481bb15c2c (patch) | |
| tree | 5fe955c16e192434f30ed93b3ff968ca9c7d3c6a /openssl/src/x509/mod.rs | |
| parent | Merge pull request #566 from sfackler/pkcs12-tweaks (diff) | |
| download | rust-openssl-557b936e27177718b62d31dcf3364f481bb15c2c.tar.xz rust-openssl-557b936e27177718b62d31dcf3364f481bb15c2c.zip | |
Added X509ReqRef.subject_name and X509ReqRef.version
Diffstat (limited to 'openssl/src/x509/mod.rs')
| -rw-r--r-- | openssl/src/x509/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index e75dcf5d..2edfa675 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -599,6 +599,21 @@ impl X509Req { impl X509ReqRef { to_pem!(ffi::PEM_write_bio_X509_REQ); to_der!(ffi::i2d_X509_REQ); + + pub fn version(&self) -> i64 + { + unsafe { + let version = compat::X509_REQ_get_version(self.as_ptr()); + version + } + } + + pub fn subject_name(&self) -> &X509NameRef { + unsafe { + let name = compat::X509_REQ_get_subject_name(self.as_ptr()); + X509NameRef::from_ptr(name) + } + } } /// A collection of X.509 extensions. @@ -779,6 +794,8 @@ mod compat { pub use ffi::X509_getm_notBefore as X509_get_notBefore; pub use ffi::X509_up_ref; pub use ffi::X509_get0_extensions; + pub use ffi::X509_REQ_get_version; + pub use ffi::X509_REQ_get_subject_name; } #[cfg(ossl10x)] @@ -812,4 +829,14 @@ mod compat { (*info).extensions } } + + pub unsafe fn X509_REQ_get_version(x: *mut ffi::X509_REQ) -> ::libc::c_long + { + ::ffi::ASN1_INTEGER_get((*(*x).req_info).version) + } + + pub unsafe fn X509_REQ_get_subject_name(x: *mut ffi::X509_REQ) -> *mut ::ffi::X509_NAME + { + (*(*x).req_info).subject + } } |