Struct solana_zk_token_sdk::encryption::elgamal::ElGamalKeypair
source · [−]pub struct ElGamalKeypair {
pub public: ElGamalPubkey,
pub secret: ElGamalSecretKey,
}
Expand description
A (twisted) ElGamal encryption keypair.
The instances of the secret key are zeroized on drop.
Fields
public: ElGamalPubkey
The public half of this keypair.
secret: ElGamalSecretKey
The secret half of this keypair.
Implementations
sourceimpl ElGamalKeypair
impl ElGamalKeypair
sourcepub fn new(signer: &dyn Signer, address: &Pubkey) -> Result<Self, SignerError>
pub fn new(signer: &dyn Signer, address: &Pubkey) -> Result<Self, SignerError>
Deterministically derives an ElGamal keypair from an Ed25519 signing key and a Solana address.
sourcepub fn new_rand() -> Self
pub fn new_rand() -> Self
Generates the public and secret keys for ElGamal encryption.
This function is randomized. It internally samples a scalar element using OsRng
.
pub fn to_bytes(&self) -> [u8; 64]
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
sourcepub fn read_json<R: Read>(reader: &mut R) -> Result<Self, Box<dyn Error>>
pub fn read_json<R: Read>(reader: &mut R) -> Result<Self, Box<dyn Error>>
Reads a JSON-encoded keypair from a Reader
implementor
sourcepub fn read_json_file<F: AsRef<Path>>(path: F) -> Result<Self, Box<dyn Error>>
pub fn read_json_file<F: AsRef<Path>>(path: F) -> Result<Self, Box<dyn Error>>
Reads keypair from a file
Trait Implementations
sourceimpl Clone for ElGamalKeypair
impl Clone for ElGamalKeypair
sourcefn clone(&self) -> ElGamalKeypair
fn clone(&self) -> ElGamalKeypair
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ElGamalKeypair
impl Debug for ElGamalKeypair
sourceimpl<'de> Deserialize<'de> for ElGamalKeypair
impl<'de> Deserialize<'de> for ElGamalKeypair
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<ElGamalKeypair> for ElGamalKeypair
impl PartialEq<ElGamalKeypair> for ElGamalKeypair
sourcefn eq(&self, other: &ElGamalKeypair) -> bool
fn eq(&self, other: &ElGamalKeypair) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ElGamalKeypair) -> bool
fn ne(&self, other: &ElGamalKeypair) -> bool
This method tests for !=
.
sourceimpl Serialize for ElGamalKeypair
impl Serialize for ElGamalKeypair
sourceimpl Zeroize for ElGamalKeypair
impl Zeroize for ElGamalKeypair
impl StructuralPartialEq for ElGamalKeypair
Auto Trait Implementations
impl RefUnwindSafe for ElGamalKeypair
impl Send for ElGamalKeypair
impl Sync for ElGamalKeypair
impl Unpin for ElGamalKeypair
impl UnwindSafe for ElGamalKeypair
Blanket Implementations
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
default fn visit_for_abi(
&self,
_digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
default fn visit_for_abi(
&self,
digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more