pub struct PrivateKey<C: Curve> { /* private fields */ }Expand description
An ECDH private key over the given curve.
Implementations§
Source§impl<C: Curve> PrivateKey<C>
impl<C: Curve> PrivateKey<C>
Sourcepub fn from_big_endian(scalar: &[u8]) -> Option<Self>
pub fn from_big_endian(scalar: &[u8]) -> Option<Self>
Parse a PrivateKey from a zero-padded, big-endian representation of the secret scalar.
Sourcepub fn to_big_endian(&self) -> Buffer
pub fn to_big_endian(&self) -> Buffer
Return the private key as zero-padded, big-endian bytes.
Sourcepub fn from_der_ec_private_key(der: &[u8]) -> Option<Self>
pub fn from_der_ec_private_key(der: &[u8]) -> Option<Self>
Parse an ECPrivateKey structure (from RFC 5915). The key must be on the specified curve.
Sourcepub fn to_der_ec_private_key(&self) -> Buffer
pub fn to_der_ec_private_key(&self) -> Buffer
Serialize this private key as an ECPrivateKey structure (from RFC 5915).
Sourcepub fn from_der_private_key_info(der: &[u8]) -> Option<Self>
pub fn from_der_private_key_info(der: &[u8]) -> Option<Self>
Parse a PrivateKeyInfo structure (from RFC 5208), commonly called “PKCS#8 format”. The key must be on the specified curve.
Sourcepub fn to_der_private_key_info(&self) -> Buffer
pub fn to_der_private_key_info(&self) -> Buffer
Serialize this private key as a PrivateKeyInfo structure (from RFC 5208), commonly called “PKCS#8 format”.
Sourcepub fn to_x962_uncompressed(&self) -> Buffer
pub fn to_x962_uncompressed(&self) -> Buffer
Serialize the public part of this key in uncompressed X9.62 format.
Sourcepub fn to_der_subject_public_key_info(&self) -> Buffer
pub fn to_der_subject_public_key_info(&self) -> Buffer
Serialize this key in SubjectPublicKeyInfo format.
Sourcepub fn to_public_key(&self) -> PublicKey<C>
pub fn to_public_key(&self) -> PublicKey<C>
Return the public key corresponding to this private key.
Auto Trait Implementations§
impl<C> Freeze for PrivateKey<C>
impl<C> RefUnwindSafe for PrivateKey<C>where
C: RefUnwindSafe,
impl<C> Send for PrivateKey<C>where
C: Send,
impl<C> Sync for PrivateKey<C>where
C: Sync,
impl<C> Unpin for PrivateKey<C>where
C: Unpin,
impl<C> UnsafeUnpin for PrivateKey<C>
impl<C> UnwindSafe for PrivateKey<C>where
C: UnwindSafe,
Blanket Implementations§
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