Struct blsttc::SecretKey[][src]

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.

Serde integration

SecretKey implements Deserialize but not Serialize to avoid accidental serialization in insecure contexts. To enable both use the ::serde_impl::SerdeSecret wrapper which implements both Deserialize and Serialize.

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::sample(). If you do not need to specify your own RNG, you should use the SecretKey::random() constructor, which uses rand::thread_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)).

Converts the secret key to big endian bytes

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

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

Deserialize this value from the given Serde deserializer. Read more

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

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

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 !=.

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. 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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

recently added

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.