[−][src]Struct ring::signature::Ed25519KeyPair
An Ed25519 key pair, for signing.
Methods
impl<'a> Ed25519KeyPair
[src]
pub fn generate(rng: &dyn SecureRandom) -> Result<Ed25519KeyPair, Unspecified>
[src]
Generates a new random key pair. There is no way to extract the private
key bytes to save them. If you need to save the private key bytes for
future use then use generate_serializable()
instead.
pub fn generate_serializable(
rng: &dyn SecureRandom
) -> Result<(Ed25519KeyPair, Ed25519KeyPairBytes), Unspecified>
[src]
rng: &dyn SecureRandom
) -> Result<(Ed25519KeyPair, Ed25519KeyPairBytes), Unspecified>
Generates a new key pair and returns the key pair as both an
Ed25519KeyPair
and a Ed25519KeyPairBytes
. There is no way to
extract the private key bytes from an Ed25519KeyPair
, so extracting
the values from the Ed25519KeyPairBytes
is the only way to get them.
pub fn from_bytes(
private_key: &[u8],
public_key: &[u8]
) -> Result<Ed25519KeyPair, Unspecified>
[src]
private_key: &[u8],
public_key: &[u8]
) -> Result<Ed25519KeyPair, Unspecified>
Copies key data from the given slices to create a new key pair. The first slice must hold the private key and the second slice must hold the public key. Both slices must contain 32 little-endian-encoded bytes.
This is intended for use by code that deserializes key pairs.
The private and public keys will be verified to be consistent. This helps protect, for example, against the accidental swapping of the public and private components of the key pair. This also detects corruption that might have occurred during storage of the key pair.
pub fn public_key_bytes(&'a self) -> &'a [u8]
[src]
Returns a reference to the little-endian-encoded public key bytes.
pub fn sign(&self, msg: &[u8]) -> Signature
[src]
Returns the signature of the message msg
.
Auto Trait Implementations
impl Send for Ed25519KeyPair
impl Sync for Ed25519KeyPair
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,