pub struct SecretKey { /* private fields */ }
Expand description
A secret key.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn generate_with_rng<R>(csprng: &mut R) -> SecretKeywhere
R: CryptoRngCore + ?Sized,
pub fn generate_with_rng<R>(csprng: &mut R) -> SecretKeywhere
R: CryptoRngCore + ?Sized,
Generate a new SecretKey
with a randomness generator.
Sourcepub fn to_openssh(&self) -> Result<Zeroizing<String>, Error>
pub fn to_openssh(&self) -> Result<Zeroizing<String>, Error>
Serialise this key to OpenSSH format.
Sourcepub fn try_from_openssh<T>(data: T) -> Result<SecretKey, Error>
pub fn try_from_openssh<T>(data: T) -> Result<SecretKey, Error>
Deserialise this key from OpenSSH format.
Sourcepub fn sign(&self, msg: &[u8]) -> Signature
pub fn sign(&self, msg: &[u8]) -> Signature
Sign the given message and return a digital signature
Sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
Convert this to the bytes representing the secret part. The public part can always be recovered.
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> SecretKey
pub fn from_bytes(bytes: &[u8; 32]) -> SecretKey
Create a secret key from its byte representation.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SecretKey
impl<'de> Deserialize<'de> for SecretKey
Source§fn deserialize<D>(
deserializer: D,
) -> Result<SecretKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SecretKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<SigningKey> for SecretKey
impl From<SigningKey> for SecretKey
Source§fn from(secret: SigningKey) -> SecretKey
fn from(secret: SigningKey) -> SecretKey
Converts to this type from the input type.
Source§impl Serialize for SecretKey
impl Serialize for SecretKey
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl !Freeze for SecretKey
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnwindSafe for SecretKey
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)