[][src]Struct ring::signature::Ed25519KeyPair

pub struct Ed25519KeyPair { /* fields omitted */ }

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]

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]

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

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]