diff options
| author | Brian Chin <[email protected]> | 2017-01-30 16:51:10 -0800 |
|---|---|---|
| committer | Brian Chin <[email protected]> | 2017-01-30 16:51:10 -0800 |
| commit | 302ee77d32acb0b92fe563f29c36882e3b9b7d62 (patch) | |
| tree | d67728147befc2ffe837ea106c9f83c7337ebbd4 /openssl/src/pkey.rs | |
| parent | Fixing typo (diff) | |
| download | rust-openssl-302ee77d32acb0b92fe563f29c36882e3b9b7d62.tar.xz rust-openssl-302ee77d32acb0b92fe563f29c36882e3b9b7d62.zip | |
Adding suggestions from review.
Diffstat (limited to 'openssl/src/pkey.rs')
| -rw-r--r-- | openssl/src/pkey.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs index fd963c24..0d8de1dd 100644 --- a/openssl/src/pkey.rs +++ b/openssl/src/pkey.rs @@ -8,7 +8,7 @@ use bio::MemBioSlice; use dh::Dh; use dsa::Dsa; use ec::EcKey; -use rsa::Rsa; +use rsa::{Rsa, Padding}; use error::ErrorStack; use util::{CallbackState, invoke_passwd_cb_old}; use types::{OpenSslType, OpenSslTypeRef}; @@ -153,6 +153,23 @@ impl PKey { pub struct PKeyCtxRef(::util::Opaque); +impl PKeyCtxRef { + pub fn set_rsa_padding(&mut self, pad: Padding) -> Result<(), ErrorStack> { + unsafe { + try!(cvt(ffi::EVP_PKEY_CTX_set_rsa_padding(self.as_ptr(), pad.as_raw()))); + } + Ok(()) + } + + pub fn rsa_padding(&mut self) -> Result<Padding, ErrorStack> { + let mut pad: c_int = 0; + unsafe { + try!(cvt(ffi::EVP_PKEY_CTX_get_rsa_padding(self.as_ptr(), &mut pad))); + }; + Ok(Padding::from_raw(pad)) + } +} + impl ::types::OpenSslTypeRef for PKeyCtxRef { type CType = ffi::EVP_PKEY_CTX; } |