pub struct PKey<T> { /* private fields */ }
Expand description
This is a wrapper around an OpenSSL
asymmetric key pair. Since openssl 0.10, the PKey is either
a public or private key so we have to differentiate that as well.
Implementations
sourceimpl PKey<Private>
impl PKey<Private>
pub fn new(bit_length: u32) -> PKey<Private>
pub fn wrap_private_key(pkey: PKey<Private>) -> PKey<Private>
pub fn from_pem(pem: &[u8]) -> Result<PKey<Private>, PKeyError>
pub fn private_key_to_pem(&self) -> Result<Vec<u8, Global>, PKeyError>
sourcepub fn sign_sha1(
&self,
data: &[u8],
signature: &mut [u8]
) -> Result<usize, StatusCode>
pub fn sign_sha1(
&self,
data: &[u8],
signature: &mut [u8]
) -> Result<usize, StatusCode>
Signs the data using RSA-SHA1
sourcepub fn sign_sha256(
&self,
data: &[u8],
signature: &mut [u8]
) -> Result<usize, StatusCode>
pub fn sign_sha256(
&self,
data: &[u8],
signature: &mut [u8]
) -> Result<usize, StatusCode>
Signs the data using RSA-SHA256
sourceimpl PKey<Public>
impl PKey<Public>
pub fn wrap_public_key(pkey: PKey<Public>) -> PKey<Public>
sourcepub fn verify_sha1(
&self,
data: &[u8],
signature: &[u8]
) -> Result<bool, StatusCode>
pub fn verify_sha1(
&self,
data: &[u8],
signature: &[u8]
) -> Result<bool, StatusCode>
Verifies the data using RSA-SHA1
sourcepub fn verify_sha256(
&self,
data: &[u8],
signature: &[u8]
) -> Result<bool, StatusCode>
pub fn verify_sha256(
&self,
data: &[u8],
signature: &[u8]
) -> Result<bool, StatusCode>
Verifies the data using RSA-SHA256
Trait Implementations
sourceimpl KeySize for PKey<Private>
impl KeySize for PKey<Private>
sourcefn bit_length(&self) -> usize
fn bit_length(&self) -> usize
Length in bits
fn size(&self) -> usize
fn calculate_cipher_text_size(
&self,
data_size: usize,
padding: RsaPadding
) -> usize
fn plain_text_block_size(&self, padding: RsaPadding) -> usize
fn cipher_text_block_size(&self) -> usize
sourceimpl KeySize for PKey<Public>
impl KeySize for PKey<Public>
sourcefn bit_length(&self) -> usize
fn bit_length(&self) -> usize
Length in bits
fn size(&self) -> usize
fn calculate_cipher_text_size(
&self,
data_size: usize,
padding: RsaPadding
) -> usize
fn plain_text_block_size(&self, padding: RsaPadding) -> usize
fn cipher_text_block_size(&self) -> usize
Auto Trait Implementations
impl<T> RefUnwindSafe for PKey<T> where
T: RefUnwindSafe,
impl<T> Send for PKey<T>
impl<T> Sync for PKey<T>
impl<T> Unpin for PKey<T> where
T: Unpin,
impl<T> UnwindSafe for PKey<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more