diff options
| author | Manuel Schölling <[email protected]> | 2015-04-15 22:54:03 +0200 |
|---|---|---|
| committer | Manuel Schölling <[email protected]> | 2015-04-15 22:59:07 +0200 |
| commit | 7db00b97ba4a5e513e2a8bd555bd2b2c36bc0afa (patch) | |
| tree | 56fdf39753142c496084d554f6feeb836786ec46 /openssl/src/crypto | |
| parent | Fix nightly build issues (diff) | |
| download | rust-openssl-7db00b97ba4a5e513e2a8bd555bd2b2c36bc0afa.tar.xz rust-openssl-7db00b97ba4a5e513e2a8bd555bd2b2c36bc0afa.zip | |
Add X509::public_key()
Diffstat (limited to 'openssl/src/crypto')
| -rw-r--r-- | openssl/src/crypto/pkey.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs index 8454f252..33433b0c 100644 --- a/openssl/src/crypto/pkey.rs +++ b/openssl/src/crypto/pkey.rs @@ -11,7 +11,7 @@ use ffi; use ssl::error::{SslError, StreamError}; #[derive(Copy, Clone)] -enum Parts { +pub enum Parts { Neither, Public, Both @@ -70,6 +70,16 @@ impl PKey { } } + pub fn from_handle(handle: *mut ffi::EVP_PKEY, parts: Parts) -> PKey { + ffi::init(); + assert!(!handle.is_null()); + + PKey { + evp: handle, + parts: parts, + } + } + /// Reads private key from PEM, takes ownership of handle pub fn private_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where R: Read { let mut mem_bio = try!(MemBio::new()); |