diff options
| author | Brian Chin <[email protected]> | 2017-01-30 10:08:25 -0800 |
|---|---|---|
| committer | Brian Chin <[email protected]> | 2017-01-30 15:04:44 -0800 |
| commit | 588fd33552f9c84e8ed67c4cff35264b671362d9 (patch) | |
| tree | 5b78ccd0a20363dc3fc05f0cc32e3fe344b64d01 /openssl/src/rsa.rs | |
| parent | Add the necessary constants to access the pkey ctx stuff. (diff) | |
| download | rust-openssl-588fd33552f9c84e8ed67c4cff35264b671362d9.tar.xz rust-openssl-588fd33552f9c84e8ed67c4cff35264b671362d9.zip | |
Testing first version that works with signer.
Diffstat (limited to 'openssl/src/rsa.rs')
| -rw-r--r-- | openssl/src/rsa.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/openssl/src/rsa.rs b/openssl/src/rsa.rs index 8c3507f4..75893545 100644 --- a/openssl/src/rsa.rs +++ b/openssl/src/rsa.rs @@ -10,9 +10,10 @@ use bio::MemBioSlice; use error::ErrorStack; use util::{CallbackState, invoke_passwd_cb_old}; use types::OpenSslTypeRef; +use pkey::PKeyCtxRef; /// Type of encryption padding to use. -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct Padding(c_int); pub const NO_PADDING: Padding = Padding(ffi::RSA_NO_PADDING); @@ -343,6 +344,22 @@ mod compat { } } +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.0))); + } + Ok(()) + } + + pub fn get_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(pad)) + } +} #[cfg(test)] mod test { |