Struct openssl::pkey::PKeyRef [−][src]
pub struct PKeyRef<T>(_, _);
Reference to PKey
.
Methods
impl<T> PKeyRef<T>
[src]
impl<T> PKeyRef<T>
pub fn rsa(&self) -> Result<Rsa<T>, ErrorStack>
[src]
pub fn rsa(&self) -> Result<Rsa<T>, ErrorStack>
Returns a copy of the internal RSA key.
This corresponds to EVP_PKEY_get1_RSA
.
pub fn dsa(&self) -> Result<Dsa<T>, ErrorStack>
[src]
pub fn dsa(&self) -> Result<Dsa<T>, ErrorStack>
Returns a copy of the internal DSA key.
This corresponds to EVP_PKEY_get1_DSA
.
pub fn dh(&self) -> Result<Dh<T>, ErrorStack>
[src]
pub fn dh(&self) -> Result<Dh<T>, ErrorStack>
Returns a copy of the internal DH key.
This corresponds to EVP_PKEY_get1_DH
.
pub fn ec_key(&self) -> Result<EcKey<T>, ErrorStack>
[src]
pub fn ec_key(&self) -> Result<EcKey<T>, ErrorStack>
Returns a copy of the internal elliptic curve key.
This corresponds to EVP_PKEY_get1_EC_KEY
.
pub fn id(&self) -> Id
[src]
pub fn id(&self) -> Id
Returns the Id
that represents the type of this key.
This corresponds to EVP_PKEY_id
.
impl<T> PKeyRef<T> where
T: HasPublic,
[src]
impl<T> PKeyRef<T> where
T: HasPublic,
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
[src]
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the public key into a PEM-encoded SubjectPublicKeyInfo structure.
The output will have a header of -----BEGIN PUBLIC KEY-----
.
This corresponds to PEM_write_bio_PUBKEY
.
pub fn public_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
[src]
pub fn public_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the public key into a DER-encoded SubjectPublicKeyInfo structure.
This corresponds to i2d_PUBKEY
.
pub fn bits(&self) -> u32
[src]
pub fn bits(&self) -> u32
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<U>(&self, other: &PKeyRef<U>) -> bool where
U: HasPublic,
[src]
pub fn public_eq<U>(&self, other: &PKeyRef<U>) -> bool where
U: HasPublic,
Compares the public component of this key with another.
impl<T> PKeyRef<T> where
T: HasPrivate,
[src]
impl<T> PKeyRef<T> where
T: HasPrivate,
pub fn private_key_to_pem_pkcs8(&self) -> Result<Vec<u8>, ErrorStack>
[src]
pub fn private_key_to_pem_pkcs8(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to a PEM-encoded PKCS#8 PrivateKeyInfo structure.
The output will have a header of -----BEGIN PRIVATE KEY-----
.
This corresponds to PEM_write_bio_PKCS8PrivateKey
.
pub fn private_key_to_pem_pkcs8_passphrase(
&self,
cipher: Cipher,
passphrase: &[u8]
) -> Result<Vec<u8>, ErrorStack>
[src]
pub fn private_key_to_pem_pkcs8_passphrase(
&self,
cipher: Cipher,
passphrase: &[u8]
) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to a PEM-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
The output will have a header of -----BEGIN ENCRYPTED PRIVATE KEY-----
.
This corresponds to PEM_write_bio_PKCS8PrivateKey
.
pub fn private_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
[src]
pub fn private_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to a DER-encoded key type specific format.
This corresponds to i2d_PrivateKey
.
Trait Implementations
impl<T> Borrow<PKeyRef<T>> for PKey<T>
[src]
impl<T> Borrow<PKeyRef<T>> for PKey<T>
impl<T> AsRef<PKeyRef<T>> for PKey<T>
[src]
impl<T> AsRef<PKeyRef<T>> for PKey<T>
impl<T> ForeignTypeRef for PKeyRef<T>
[src]
impl<T> ForeignTypeRef for PKeyRef<T>
type CType = EVP_PKEY
The raw C type.
ⓘImportant traits for &'a mut Runsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self
[src]
unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self
Constructs a shared instance of this type from its raw type.
ⓘImportant traits for &'a mut Runsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self
[src]
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
[src]
fn as_ptr(&self) -> *mut Self::CType
Returns a raw pointer to the wrapped value.
impl<T> Send for PKeyRef<T>
[src]
impl<T> Send for PKeyRef<T>
impl<T> Sync for PKeyRef<T>
[src]
impl<T> Sync for PKeyRef<T>