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
SecretKey
s 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.
Deserialize from big endian bytes
Returns the decrypted text, or None
, if the ciphertext isn’t valid.
Trait Implementations
A debug statement where the secret prime field element is redacted.
Creates a SecretKey
containing the zero prime field element.
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
Auto Trait Implementations
impl RefUnwindSafe for SecretKey
impl UnwindSafe for SecretKey
Blanket Implementations
Mutably borrows from an owned value. Read more