Struct diem_crypto::x25519::PrivateKey[][src]

pub struct PrivateKey(_);
Expand description

This type should be used to deserialize a received private key

Implementations

Obtain the public key part of a private key

To perform a key exchange with another public key

Deserialize an X25119 PrivateKey given the sha512 pre-image of a hash whose least significant half is a canonical X25519 scalar, following the XEdDSA approach.

This will FAIL if the passed-in byte representation converts to a non-canonical scalar in the X25519 sense (and thus cannot correspond to a X25519 valid key without bit-mangling).

This is meant to compensate for the poor key storage capabilities of some key management solutions, and NOT to promote double usage of keys under several schemes, which would lead to BAD vulnerabilities.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

We require public / private types to be coupled, i.e. their associated type is each other. Read more

Returns the associated public key

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Generate key material from an RNG. This should generally not be used for production purposes even with a good source of randomness. When possible use hardware crypto to generate and store private keys. Read more

Generate a random key using the shared TEST_SEED

Convert the valid crypto material to bytes.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

Generates a hash used only for tests.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

When trying to convert from bytes, we simply decode the string into bytes before checking if we can convert. Read more

A function to encode into hex-string after serializing.