Struct chain_vote::cryptography::elgamal::SecretKey
source · pub struct SecretKey {
pub sk: Scalar,
}
Expand description
ElGamal secret key
Fields§
§sk: Scalar
Implementations§
source§impl SecretKey
impl SecretKey
pub const BYTES_LEN: usize = 32usize
pub fn generate<R: RngCore + CryptoRng>(rng: &mut R) -> Self
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub(crate) fn recover_symmetric_key( &self, ciphertext: &HybridCiphertext ) -> SymmetricKey
sourcepub(crate) fn hybrid_decrypt(&self, ciphertext: &HybridCiphertext) -> Vec<u8>
pub(crate) fn hybrid_decrypt(&self, ciphertext: &HybridCiphertext) -> Vec<u8>
Decrypt a message using hybrid decryption
sourcepub(crate) fn decrypt_point(&self, cipher: &Ciphertext) -> GroupElement
pub(crate) fn decrypt_point(&self, cipher: &Ciphertext) -> GroupElement
Decrypt ElGamal Ciphertext
= (cipher
.e1, cipher
.e2), by computing
cipher
.e2 - self
* cipher
.e1. This returns the plaintext respresented
as a GroupElement
.
Trait Implementations§
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more