[−][src]Struct openssl::crypto::pkey::PKey
Methods
impl PKey
[src]
impl PKey
Represents a public key, optionally with a private key attached.
pub fn new() -> PKey
[src]
pub fn new() -> PKey
pub fn from_handle(handle: *mut EVP_PKEY, parts: Parts) -> PKey
[src]
pub fn from_handle(handle: *mut EVP_PKEY, parts: Parts) -> PKey
pub fn private_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
[src]
pub fn private_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
Reads private key from PEM, takes ownership of handle
pub fn public_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
[src]
pub fn public_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
Reads public key from PEM, takes ownership of handle
pub fn private_rsa_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
[src]
pub fn private_rsa_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
Reads an RSA private key from PEM, takes ownership of handle
pub fn public_rsa_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
[src]
pub fn public_rsa_key_from_pem<R>(reader: &mut R) -> Result<PKey, SslError> where
R: Read,
Reads an RSA public key from PEM, takes ownership of handle
pub fn gen(&mut self, keysz: usize)
[src]
pub fn gen(&mut self, keysz: usize)
pub fn set_rsa(&mut self, rsa: &RSA)
[src]
pub fn set_rsa(&mut self, rsa: &RSA)
assign RSA key to this pkey
pub fn get_rsa(&self) -> RSA
[src]
pub fn get_rsa(&self) -> RSA
get a reference to the interal RSA key for direct access to the key components
pub fn save_pub(&self) -> Vec<u8>
[src]
pub fn save_pub(&self) -> Vec<u8>
Returns a DER serialized form of the public key, suitable for load_pub().
pub fn load_pub(&mut self, s: &[u8])
[src]
pub fn load_pub(&mut self, s: &[u8])
Loads a DER serialized form of the public key, as produced by save_pub().
pub fn save_priv(&self) -> Vec<u8>
[src]
pub fn save_priv(&self) -> Vec<u8>
Returns a serialized form of the public and private keys, suitable for load_priv().
pub fn load_priv(&mut self, s: &[u8])
[src]
pub fn load_priv(&mut self, s: &[u8])
Loads a serialized form of the public and private keys, as produced by save_priv().
pub fn write_pem<W: Write>(&self, writer: &mut W) -> Result<(), SslError>
[src]
pub fn write_pem<W: Write>(&self, writer: &mut W) -> Result<(), SslError>
Stores private key as a PEM
pub fn write_pub_pem<W: Write>(&self, writer: &mut W) -> Result<(), SslError>
[src]
pub fn write_pub_pem<W: Write>(&self, writer: &mut W) -> Result<(), SslError>
Stores public key as a PEM
pub fn size(&self) -> usize
[src]
pub fn size(&self) -> usize
Returns the size of the public key modulus.
pub fn can(&self, r: Role) -> bool
[src]
pub fn can(&self, r: Role) -> bool
Returns whether this pkey object can perform the specified role.
pub fn max_data(&self) -> usize
[src]
pub fn max_data(&self) -> usize
Returns the maximum amount of data that can be encrypted by an encrypt() call.
pub fn private_encrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
[src]
pub fn private_encrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
pub fn public_encrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
[src]
pub fn public_encrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
pub fn private_decrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
[src]
pub fn private_decrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
pub fn public_decrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
[src]
pub fn public_decrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
pub fn encrypt(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn encrypt(&self, s: &[u8]) -> Vec<u8>
Encrypts data with the public key, using OAEP padding, returning the encrypted data. The supplied data must not be larger than max_data().
pub fn encrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
[src]
pub fn encrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
Encrypts data with the public key, using provided padding, returning the encrypted data. The supplied data must not be larger than max_data().
pub fn public_encrypt(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn public_encrypt(&self, s: &[u8]) -> Vec<u8>
Encrypts data with the public key, using OAEP padding, returning the encrypted data. The supplied data must not be larger than max_data().
pub fn public_decrypt(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn public_decrypt(&self, s: &[u8]) -> Vec<u8>
Decrypts data with the public key, using PKCS1v15 padding, returning the decrypted data.
pub fn decrypt(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn decrypt(&self, s: &[u8]) -> Vec<u8>
Decrypts data with the private key, expecting OAEP padding, returning the decrypted data.
pub fn decrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
[src]
pub fn decrypt_with_padding(
&self,
s: &[u8],
padding: EncryptionPadding
) -> Vec<u8>
Decrypts data with the private key, using provided padding, returning the encrypted data. The supplied data must not be larger than max_data().
pub fn private_decrypt(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn private_decrypt(&self, s: &[u8]) -> Vec<u8>
Decrypts data with the private key, expecting OAEP padding, returning the decrypted data.
pub fn private_encrypt(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn private_encrypt(&self, s: &[u8]) -> Vec<u8>
Encrypts data with the private key, using PKCS1v15 padding, returning the encrypted data. The supplied data must not be larger than max_data().
pub fn sign(&self, s: &[u8]) -> Vec<u8>
[src]
pub fn sign(&self, s: &[u8]) -> Vec<u8>
Signs data, using OpenSSL's default scheme and adding sha256 ASN.1 information to the signature. The bytes to sign must be the result of a sha256 hashing; returns the signature.
pub fn verify(&self, h: &[u8], s: &[u8]) -> bool
[src]
pub fn verify(&self, h: &[u8], s: &[u8]) -> bool
Verifies a signature s (using OpenSSL's default scheme and sha256) on the SHA256 hash of a message. Returns true if the signature is valid, and false otherwise.
pub fn sign_with_hash(&self, s: &[u8], hash: Type) -> Vec<u8>
[src]
pub fn sign_with_hash(&self, s: &[u8], hash: Type) -> Vec<u8>
Signs data, using OpenSSL's default scheme and add ASN.1 information for the given hash type to the signature. The bytes to sign must be the result of this type of hashing; returns the signature.
pub fn verify_with_hash(&self, h: &[u8], s: &[u8], hash: Type) -> bool
[src]
pub fn verify_with_hash(&self, h: &[u8], s: &[u8], hash: Type) -> bool
pub unsafe fn get_handle(&self) -> *mut EVP_PKEY
[src]
pub unsafe fn get_handle(&self) -> *mut EVP_PKEY
pub fn public_eq(&self, other: &PKey) -> bool
[src]
pub fn public_eq(&self, other: &PKey) -> bool
Trait Implementations
impl Clone for PKey
[src]
impl Clone for PKey
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Drop for PKey
[src]
impl Drop for PKey
impl Sync for PKey
[src]
impl Sync for PKey
impl Send for PKey
[src]
impl Send for PKey
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more