Struct openssl::pkey::PKey
[−]
pub struct PKey(_);
Methods
impl PKey
[src]
pub fn from_rsa(rsa: Rsa) -> Result<PKey, ErrorStack>
[src]
Creates a new PKey
containing an RSA key.
pub fn from_dsa(dsa: Dsa) -> Result<PKey, ErrorStack>
[src]
Creates a new PKey
containing a DSA key.
pub fn from_dh(dh: Dh) -> Result<PKey, ErrorStack>
[src]
Creates a new PKey
containing a Diffie-Hellman key.
pub fn from_ec_key(ec_key: EcKey) -> Result<PKey, ErrorStack>
[src]
Creates a new PKey
containing an elliptic curve key.
pub fn hmac(key: &[u8]) -> Result<PKey, ErrorStack>
[src]
pub fn private_key_from_pem(pem: &[u8]) -> Result<PKey, ErrorStack>
[src]
Deserializes a PEM-formatted private key.
pub fn private_key_from_pem_passphrase(
pem: &[u8],
passphrase: &[u8]
) -> Result<PKey, ErrorStack>
[src]
pem: &[u8],
passphrase: &[u8]
) -> Result<PKey, ErrorStack>
Deserializes a PEM-formatted private key, using the supplied password if the key is encrypted.
Panics
Panics if passphrase
contains an embedded null.
pub fn private_key_from_pem_callback<F>(
pem: &[u8],
callback: F
) -> Result<PKey, ErrorStack> where
F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack>,
[src]
pem: &[u8],
callback: F
) -> Result<PKey, ErrorStack> where
F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack>,
Deserializes a PEM-formatted private key, using a callback to retrieve a password if the key is encrypted.
The callback should copy the password into the provided buffer and return the number of bytes written.
pub fn public_key_from_pem(pem: &[u8]) -> Result<PKey, ErrorStack>
[src]
Deserializes a public key from PEM-formatted data.
pub fn public_key_from_der(der: &[u8]) -> Result<PKey, ErrorStack>
[src]
Deserializes a public key from DER-formatted data.
pub fn private_key_from_der(der: &[u8]) -> Result<PKey, ErrorStack>
[src]
Deserializes a private key from DER-formatted data.
pub fn private_key_from_pkcs8_callback<F>(
der: &[u8],
callback: F
) -> Result<PKey, ErrorStack> where
F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack>,
[src]
der: &[u8],
callback: F
) -> Result<PKey, ErrorStack> where
F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack>,
Deserializes a DER-formatted PKCS#8 private key, using a callback to retrieve the password if the key is encrpyted.
The callback should copy the password into the provided buffer and return the number of bytes written.
pub fn private_key_from_pkcs8_passphrase(
der: &[u8],
passphrase: &[u8]
) -> Result<PKey, ErrorStack>
[src]
der: &[u8],
passphrase: &[u8]
) -> Result<PKey, ErrorStack>
Deserializes a DER-formatted PKCS#8 private key, using the supplied password if the key is encrypted.
Panics
Panics if passphrase
contains an embedded null.
pub fn private_key_from_pem_cb<F>(
buf: &[u8],
pass_cb: F
) -> Result<PKey, ErrorStack> where
F: FnOnce(&mut [c_char]) -> usize,
[src]
buf: &[u8],
pass_cb: F
) -> Result<PKey, ErrorStack> where
F: FnOnce(&mut [c_char]) -> usize,
: use private_key_from_pem_callback
Methods from Deref<Target = PKeyRef>
pub fn rsa(&self) -> Result<Rsa, ErrorStack>
[src]
Returns a copy of the internal RSA key.
pub fn dsa(&self) -> Result<Dsa, ErrorStack>
[src]
Returns a copy of the internal DSA key.
pub fn dh(&self) -> Result<Dh, ErrorStack>
[src]
Returns a copy of the internal DH key.
pub fn ec_key(&self) -> Result<EcKey, ErrorStack>
[src]
Returns a copy of the internal elliptic curve key.
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
[src]
Serializes a public key to PEM.
pub fn private_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
[src]
Serializes the private key to PEM.
pub fn private_key_to_pem_passphrase(
&self,
cipher: Cipher,
passphrase: &[u8]
) -> Result<Vec<u8>, ErrorStack>
[src]
&self,
cipher: Cipher,
passphrase: &[u8]
) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to PEM, encrypting it with the specified symmetric cipher and passphrase.
pub fn private_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
[src]
Serializes the private key to DER.
pub fn public_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
[src]
Serializes the public key to DER.
pub fn bits(&self) -> u32
[src]
Returns the size of the key.
This corresponds to the bit length of the modulus of an RSA key, and the bit length of the group order for an elliptic curve key, for example.
pub fn public_eq(&self, other: &PKeyRef) -> bool
[src]
Compares the public component of this key with another.
Trait Implementations
impl ForeignType for PKey
type CType = EVP_PKEY
The raw C type.
type Ref = PKeyRef
The type representing a reference to this type.
unsafe fn from_ptr(ptr: *mut EVP_PKEY) -> PKey
Constructs an instance of this type from its raw type.
fn as_ptr(&self) -> *mut EVP_PKEY
Returns a raw pointer to the wrapped value.
impl Drop for PKey
impl Deref for PKey
type Target = PKeyRef
The resulting type after dereferencing.
fn deref(&self) -> &PKeyRef
Dereferences the value.