pub struct SecretKey(SecretKey);Expand description
P-256 secret scalar. Zeroized on drop.
Tuple Fields§
§0: SecretKeyImplementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn from_bytes(scalar: &[u8; 32]) -> Result<Self, Error>
pub fn from_bytes(scalar: &[u8; 32]) -> Result<Self, Error>
Builds a key from a big-endian scalar.
Sourcepub fn from_pkcs8_der(der: &[u8]) -> Result<Self, Error>
pub fn from_pkcs8_der(der: &[u8]) -> Result<Self, Error>
Parses a PKCS#8 PrivateKeyInfo.
Sourcepub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, Error>
pub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, Error>
Serializes as PKCS#8 PrivateKeyInfo.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns the matching public key.
Sourcepub fn diffie_hellman(&self, peer: &PublicKey) -> Zeroizing<[u8; 32]>
pub fn diffie_hellman(&self, peer: &PublicKey) -> Zeroizing<[u8; 32]>
ECDH with peer. Returns the shared point’s x-coordinate.
Trait Implementations§
impl ZeroizeOnDrop for SecretKeywhere
SecretKey: ZeroizeOnDrop,
Auto Trait Implementations§
impl Freeze for SecretKey
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnsafeUnpin for SecretKey
impl UnwindSafe for SecretKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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