Struct openssl::rsa::RsaRef
[−]
[src]
pub struct RsaRef(_);
Methods
impl RsaRef
[src]
fn private_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to PEM.
fn private_key_to_pem_passphrase(&self,
cipher: Cipher,
passphrase: &[u8])
-> Result<Vec<u8>, ErrorStack>
cipher: Cipher,
passphrase: &[u8])
-> Result<Vec<u8>, ErrorStack>
Serializes the private key to PEM, encrypting it with the specified symmetric cipher and passphrase.
fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
Serializes a public key to PEM.
fn private_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to DER.
fn public_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the public key to DER.
fn size(&self) -> usize
fn private_decrypt(&self,
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
Decrypts data using the private key, returning the number of decrypted bytes.
Panics
Panics if self
has no private components, or if to
is smaller
than self.size()
.
fn private_encrypt(&self,
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
Encrypts data using the private key, returning the number of encrypted bytes.
Panics
Panics if self
has no private components, or if to
is smaller
than self.size()
.
fn public_decrypt(&self,
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
Decrypts data using the public key, returning the number of decrypted bytes.
Panics
Panics if to
is smaller than self.size()
.
fn public_encrypt(&self,
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
from: &[u8],
to: &mut [u8],
padding: Padding)
-> Result<usize, ErrorStack>
Encrypts data using the private key, returning the number of encrypted bytes.
Panics
Panics if to
is smaller than self.size()
.
fn n(&self) -> Option<&BigNumRef>
fn d(&self) -> Option<&BigNumRef>
fn e(&self) -> Option<&BigNumRef>
fn p(&self) -> Option<&BigNumRef>
fn q(&self) -> Option<&BigNumRef>
Trait Implementations
impl OpenSslTypeRef for RsaRef
[src]
type CType = RSA
The raw C type.
unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self
Constructs a shared instance of this type from its raw type.
unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self
Constructs a mutable reference of this type from its raw type.
fn as_ptr(&self) -> *mut Self::CType
Returns a raw pointer to the wrapped value.