pub struct SecretKey { /* private fields */ }
Available on crate feature
key
only.Expand description
A secret key.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn generate_with_rng<R: CryptoRngCore + ?Sized>(csprng: &mut R) -> Self
pub fn generate_with_rng<R: CryptoRngCore + ?Sized>(csprng: &mut R) -> Self
Generate a new SecretKey
with a randomness generator.
Sourcepub fn to_openssh(&self) -> Result<Zeroizing<String>>
pub fn to_openssh(&self) -> Result<Zeroizing<String>>
Serialise this key to OpenSSH format.
Sourcepub fn try_from_openssh<T: AsRef<[u8]>>(data: T) -> Result<Self>
pub fn try_from_openssh<T: AsRef<[u8]>>(data: T) -> Result<Self>
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]) -> Self
pub fn from_bytes(bytes: &[u8; 32]) -> Self
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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::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) -> Self
fn from(secret: SigningKey) -> Self
Converts to this type from the input type.
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<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
)