pub struct PrivateKey { /* private fields */ }Expand description
A matching certificate/private-key pair; clones share the underlying key.
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn key_type(&self) -> Option<KeyType>
pub fn key_type(&self) -> Option<KeyType>
The public key’s recognized algorithm, or None for other provider-supported types.
Sourcepub fn public_key_der(&self) -> &[u8] ⓘ
pub fn public_key_der(&self) -> &[u8] ⓘ
DER-encoded SubjectPublicKeyInfo of the matching certificate.
Sourcepub fn export_pkcs8_der(&self) -> Result<&[u8], Error>
pub fn export_pkcs8_der(&self) -> Result<&[u8], Error>
Borrows unencrypted PKCS#8 material. Never log the returned bytes.
§Errors
Error::Unsupported for opaque native keys.
Sourcepub fn sign(&self, scheme: SignScheme, message: &[u8]) -> Result<Vec<u8>, Error>
pub fn sign(&self, scheme: SignScheme, message: &[u8]) -> Result<Vec<u8>, Error>
Hashes and signs a message using scheme.
§Errors
Error::Unsupported for an incompatible scheme, or Error::Backend when signing
fails. Supported algorithms depend on the selected provider.
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PrivateKey
impl !UnwindSafe for PrivateKey
impl Freeze for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnsafeUnpin for PrivateKey
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
Mutably borrows from an owned value. Read more