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 scalar 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). 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).
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.
Compute the shared key between this private key and the given public key. The result should be used with a key derivation function that includes the two public keys.
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.