[−][src]Struct threshold_crypto::SecretKey
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
impl SecretKey
[src]
pub fn from_mut(fr: &mut Fr) -> Self
[src]
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.
pub fn random() -> Self
[src]
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.
pub fn public_key(&self) -> PublicKey
[src]
Returns the matching public key.
pub fn sign_g2<H: Into<G2Affine>>(&self, hash: H) -> Signature
[src]
Signs the given element of G2
.
pub fn sign<M: AsRef<[u8]>>(&self, msg: M) -> Signature
[src]
Signs the given message.
This is equivalent to sign_g2(hash_g2(msg))
.
pub fn decrypt(&self, ct: &Ciphertext) -> Option<Vec<u8>>
[src]
Returns the decrypted text, or None
, if the ciphertext isn't valid.
pub fn reveal(&self) -> String
[src]
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
impl Clone for SecretKey
[src]
impl Debug for SecretKey
[src]
A debug statement where the secret prime field element is redacted.
impl Default for SecretKey
[src]
Creates a SecretKey
containing the zero prime field element.
impl<'de> Deserialize<'de> for SecretKey
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Distribution<SecretKey> for Standard
[src]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> SecretKey
[src]
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.
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Drop for SecretKey
[src]
impl Eq for SecretKey
[src]
impl PartialEq<SecretKey> for SecretKey
[src]
impl StructuralEq for SecretKey
[src]
impl StructuralPartialEq for SecretKey
[src]
impl Zeroize for SecretKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnwindSafe for SecretKey
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,