pub struct SecretKey(_);
Expand description

A secret key; wraps a single prime field element. The field element is heap allocated to avoid any stack copying that result when passing SecretKeys between stack frames.

Implementations§

Creates a new SecretKey from a mutable reference to a field element. This constructor takes a reference to avoid any unnecessary stack copying/moving of secrets (i.e. the field element). The field element is copied bytewise onto the heap, the resulting Box is stored in the returned SecretKey.

WARNING this constructor will overwrite the referenced Fr element with zeros after it has been copied onto the heap.

Creates a new random instance of SecretKey. If you want to use/define your own random number generator, you should use the constructor: SecretKey::rand(). If you do not need to specify your own RNG, you should use the SecretKey::random() constructor, which uses rand::thead_rng() internally as its RNG.

Returns the matching public key.

Signs the given element of G2.

Signs the given message.

This is equivalent to sign_g2(hash_g2(msg)).

Returns the decrypted text, or None, if the ciphertext isn’t valid.

Generates a non-redacted debug string. This method differs from the Debug implementation in that it does leak the secret prime field element.

Trait Implementations§

Creates a new SecretKey by cloning another SecretKey’s prime field element.

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

A debug statement where the secret prime field element is redacted.

Formats the value using the given formatter. Read more

Creates a SecretKey containing the zero prime field element.

Returns the “default value” for a type. Read more

Zeroes out the memory allocated from the SecretKey’s field element.

Executes the destructor for this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Creates a random SecretKey from a given RNG. If you do not need to specify your own RNG, you should use SecretKey::random() as your constructor instead.

Generates a random instance of this type using the specified source of randomness. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.