Struct PKeyRef
pub struct PKeyRef<T>(/* private fields */);Expand description
Reference to PKey.
Implementations§
§impl<T> PKeyRef<T>
impl<T> PKeyRef<T>
pub fn rsa(&self) -> Result<Rsa<T>, ErrorStack>
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>
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>
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>
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
pub fn id(&self) -> Id
Returns the Id that represents the type of this key.
This corresponds to EVP_PKEY_id.
pub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the maximum size of a signature in bytes.
This corresponds to EVP_PKEY_size.
§impl<T> PKeyRef<T>where
T: HasPublic,
impl<T> PKeyRef<T>where
T: HasPublic,
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
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>
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
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>) -> boolwhere
U: HasPublic,
pub fn public_eq<U>(&self, other: &PKeyRef<U>) -> boolwhere
U: HasPublic,
Compares the public component of this key with another.
pub fn raw_public_key_len(&self) -> Result<usize, ErrorStack>
pub fn raw_public_key_len(&self) -> Result<usize, ErrorStack>
Returns the length of the “raw” form of the public key. Only supported for certain key types.
This corresponds to EVP_PKEY_get_raw_public_key.
pub fn raw_public_key<'a>(
&self,
out: &'a mut [u8],
) -> Result<&'a [u8], ErrorStack>
pub fn raw_public_key<'a>( &self, out: &'a mut [u8], ) -> Result<&'a [u8], ErrorStack>
Outputs a copy of the “raw” form of the public key. Only supported for certain key types.
Returns the used portion of out.
This corresponds to EVP_PKEY_get_raw_public_key.
§impl<T> PKeyRef<T>where
T: HasPrivate,
impl<T> PKeyRef<T>where
T: HasPrivate,
pub fn private_key_to_pem_pkcs8(&self) -> Result<Vec<u8>, ErrorStack>
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>
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>
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.
pub fn private_key_to_der_pkcs8(&self) -> Result<Vec<u8>, ErrorStack>
pub fn private_key_to_der_pkcs8(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to a DER-encoded PKCS#8 PrivateKeyInfo structure.
This corresponds to i2d_PKCS8PrivateKey_bio.
pub fn private_key_to_der_pkcs8_passphrase(
&self,
cipher: Cipher,
passphrase: &[u8],
) -> Result<Vec<u8>, ErrorStack>
pub fn private_key_to_der_pkcs8_passphrase( &self, cipher: Cipher, passphrase: &[u8], ) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to a DER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
This corresponds to i2d_PKCS8PrivateKey_bio.
pub fn raw_private_key_len(&self) -> Result<usize, ErrorStack>
pub fn raw_private_key_len(&self) -> Result<usize, ErrorStack>
Returns the length of the “raw” form of the private key. Only supported for certain key types.
This corresponds to EVP_PKEY_get_raw_private_key.
pub fn raw_private_key<'a>(
&self,
out: &'a mut [u8],
) -> Result<&'a [u8], ErrorStack>
pub fn raw_private_key<'a>( &self, out: &'a mut [u8], ) -> Result<&'a [u8], ErrorStack>
Outputs a copy of the “raw” form of the private key. Only supported for certain key types.
Returns the used portion of out.
This corresponds to EVP_PKEY_get_raw_private_key.
Trait Implementations§
§impl<T> ForeignTypeRef for PKeyRef<T>
impl<T> ForeignTypeRef for PKeyRef<T>
impl<T> Send for PKeyRef<T>
impl<T> Sync for PKeyRef<T>
Auto Trait Implementations§
impl<T> Freeze for PKeyRef<T>
impl<T> !RefUnwindSafe for PKeyRef<T>
impl<T> Unpin for PKeyRef<T>where
T: Unpin,
impl<T> UnwindSafe for PKeyRef<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more