pub struct Ed25519PrivateKey { /* private fields */ }Expand description
A structure containing information about an Ed25519 private key.
Implementations§
Source§impl Ed25519PrivateKey
impl Ed25519PrivateKey
Sourcepub fn from_ed25519(key: &[u8]) -> Result<Self>
pub fn from_ed25519(key: &[u8]) -> Result<Self>
Create a new PrivateKey from an ed25519 keypair. The keypair is a 64 byte slice, where the
first 32 bytes are the ed25519 seed, and the second 32 bytes are the public key.
Sourcepub fn from_ed25519_with_keyid_hash_algorithms(
key: &[u8],
keyid_hash_algorithms: Option<Vec<String>>,
) -> Result<Self>
pub fn from_ed25519_with_keyid_hash_algorithms( key: &[u8], keyid_hash_algorithms: Option<Vec<String>>, ) -> Result<Self>
Create a new PrivateKey from an ed25519 keypair with a custom keyid_hash_algorithms. The
keypair is a 64 byte slice, where the first 32 bytes are the ed25519 seed, and the second 32
bytes are the public key.
Sourcepub fn from_pkcs8(der_key: &[u8]) -> Result<Self>
pub fn from_pkcs8(der_key: &[u8]) -> Result<Self>
Create a private key from PKCS#8v2 DER bytes.
§Generating Keys
$ touch ed25519-private-key.pk8
$ chmod 0600 ed25519-private-key.pk8let mut file = File::open("ed25519-private-key.pk8").unwrap();
let key = Ed25519KeyPair::generate_pkcs8(&SystemRandom::new()).unwrap();
file.write_all(key.as_ref()).unwrap()Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ed25519PrivateKey
impl RefUnwindSafe for Ed25519PrivateKey
impl Send for Ed25519PrivateKey
impl Sync for Ed25519PrivateKey
impl Unpin for Ed25519PrivateKey
impl UnsafeUnpin for Ed25519PrivateKey
impl UnwindSafe for Ed25519PrivateKey
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