[−][src]Struct rust_elgamal::DecryptionKey
An ElGamal decryption key (also called a private key in other implementations).
Implementations
impl DecryptionKey
[src]
pub fn new<R: RngCore + CryptoRng>(mut rng: R) -> Self
[src]
Generate a new ElGamal decryption key using the randomness source rng
, together with
its corresponding encryption key.
Example
use rand::rngs::StdRng; use rand::SeedableRng; use rust_elgamal::DecryptionKey; let mut rng = StdRng::from_entropy(); let dec_key = DecryptionKey::new(&mut rng);
pub fn decrypt(&self, ct: Ciphertext) -> RistrettoPoint
[src]
Decrypt the ciphertext ct
.
Example
use rand::rngs::StdRng; use rand::SeedableRng; use rust_elgamal::{DecryptionKey, GENERATOR_TABLE, Scalar}; let mut rng = StdRng::from_entropy(); let dec_key = DecryptionKey::new(&mut rng); let m = &Scalar::from(5u32) * &GENERATOR_TABLE; let ct = dec_key.encryption_key().encrypt(m, &mut rng); let decrypted = dec_key.decrypt(ct); assert_eq!(m, decrypted);
pub fn encryption_key(&self) -> &EncryptionKey
[src]
Retrieve the encryption key corresponding to this decryption key.
Trait Implementations
impl AsRef<Scalar> for DecryptionKey
[src]
impl Clone for DecryptionKey
[src]
pub fn clone(&self) -> DecryptionKey
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for DecryptionKey
[src]
impl Debug for DecryptionKey
[src]
impl Eq for DecryptionKey
[src]
impl From<DecryptionKey> for EncryptionKey
[src]
pub fn from(dk: DecryptionKey) -> Self
[src]
impl From<Scalar> for DecryptionKey
[src]
impl PartialEq<DecryptionKey> for DecryptionKey
[src]
pub fn eq(&self, other: &DecryptionKey) -> bool
[src]
pub fn ne(&self, other: &DecryptionKey) -> bool
[src]
impl StructuralEq for DecryptionKey
[src]
impl StructuralPartialEq for DecryptionKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for DecryptionKey
[src]
impl Send for DecryptionKey
[src]
impl Sync for DecryptionKey
[src]
impl Unpin for DecryptionKey
[src]
impl UnwindSafe for DecryptionKey
[src]
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,