pub struct SigningKey {
pub(crate) inner: PrivateKey,
}Fields§
§inner: PrivateKeyImplementations§
Source§impl SigningKey
impl SigningKey
pub fn into_inner(self) -> PrivateKey
Sourcepub fn random<R: CryptoRngCore>(rng: R) -> Self
pub fn random<R: CryptoRngCore>(rng: R) -> Self
Generates a fresh, cryptographically random signing key using rng.
pub fn read_from_file_unencrypted<P: AsRef<Path>>( path: P, ) -> Result<Self, SigningKeyError>
Sourcepub fn read_from_file_encrypted<P: AsRef<Path>>(
path: P,
passphrase: SecretString,
) -> Result<Self, SigningKeyError>
pub fn read_from_file_encrypted<P: AsRef<Path>>( path: P, passphrase: SecretString, ) -> Result<Self, SigningKeyError>
Reads a passphrase-encrypted signing key from path.
The file is expected to be an age
payload produced via passphrase encryption (e.g. age -p) whose
plaintext is the raw encoded ed25519 private key (as produced by
commonware-codec’s Encode impl on [PrivateKey]).
After decryption the plaintext buffer is zeroized.
Sourcepub fn read_encrypted<R: BufRead>(
ciphertext: R,
passphrase: SecretString,
) -> Result<Self, SigningKeyError>
pub fn read_encrypted<R: BufRead>( ciphertext: R, passphrase: SecretString, ) -> Result<Self, SigningKeyError>
Reads a passphrase-encrypted signing key from an arbitrary
std::io::Read.
Sourcepub fn write_to_file_encrypted<P: AsRef<Path>>(
&self,
path: P,
passphrase: SecretString,
) -> Result<(), SigningKeyError>
pub fn write_to_file_encrypted<P: AsRef<Path>>( &self, path: P, passphrase: SecretString, ) -> Result<(), SigningKeyError>
Writes the signing key to path as a passphrase-encrypted age payload.
Sourcepub fn write_encrypted<W: Write>(
&self,
writer: W,
passphrase: SecretString,
) -> Result<(), SigningKeyError>
pub fn write_encrypted<W: Write>( &self, writer: W, passphrase: SecretString, ) -> Result<(), SigningKeyError>
Writes the signing key to an arbitrary std::io::Write as a
passphrase-encrypted age payload. See Self::write_to_file_encrypted.
pub fn try_from_hex(hex: &str) -> Result<Self, SigningKeyError>
Sourcepub fn to_writer_unencrypted<W: Write>(
&self,
writer: W,
) -> Result<(), SigningKeyError>
pub fn to_writer_unencrypted<W: Write>( &self, writer: W, ) -> Result<(), SigningKeyError>
Writes the signing key to writer as 0x-prefixed hex of the
raw encoded ed25519 private key bytes.
pub fn public_key(&self) -> PublicKey
Trait Implementations§
Source§impl Clone for SigningKey
impl Clone for SigningKey
Source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SigningKey
impl Debug for SigningKey
Auto Trait Implementations§
impl Freeze for SigningKey
impl RefUnwindSafe for SigningKey
impl Send for SigningKey
impl Sync for SigningKey
impl Unpin for SigningKey
impl UnsafeUnpin for SigningKey
impl UnwindSafe for SigningKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 288 bytes