[−][src]Struct elgamal_curve25519::PrivateKey
PrivateKey
is an ElGamal private key. It's just a
wrapper around Scalar
. The key is just an integer
between 1 and q-1, where q is the order of the group
G.
Methods
impl PrivateKey
[src]
pub fn new() -> Result<PrivateKey, String>
[src]
new
creates a new random PrivateKey
.
pub fn random() -> Result<PrivateKey, String>
[src]
random
creates a random PrivateKey
.
pub fn from_rng<R>(rng: &mut R) -> Result<PrivateKey, String> where
R: RngCore + CryptoRng,
[src]
R: RngCore + CryptoRng,
from_rng
creates a new random PrivateKey
, but requires
to specify a random generator.
pub fn from_hash<D>(digest: D) -> PrivateKey where
D: Digest<OutputSize = U64>,
[src]
D: Digest<OutputSize = U64>,
from_hash
creates a new PrivateKey
from a 64 bytes hash.
pub fn from_scalar(scalar: Scalar) -> Result<PrivateKey, String>
[src]
from_scalar
creates a new PrivateKey
from a Scalar
.
The Scalar
value cannot be 0.
pub fn to_scalar(&self) -> Scalar
[src]
to_scalar
returns the inner Scalar
of the PrivateKey
.
pub fn from_bytes(buf: [u8; 32]) -> Result<PrivateKey, String>
[src]
from_bytes
creates a new PrivateKey
from a slice of bytes.
pub fn to_bytes(&self) -> [u8; 32]
[src]
to_bytes
returns the PrivateKey
as an array of bytes.
pub fn to_public(&self) -> PublicKey
[src]
to_public
returns the PublicKey
of the PrivateKey
.
Trait Implementations
impl Copy for PrivateKey
[src]
impl Clone for PrivateKey
[src]
fn clone(&self) -> PrivateKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<PrivateKey> for PrivateKey
[src]
fn eq(&self, other: &PrivateKey) -> bool
[src]
fn ne(&self, other: &PrivateKey) -> bool
[src]
impl Eq for PrivateKey
[src]
impl Add<PrivateKey> for PrivateKey
[src]
type Output = Option<PrivateKey>
The resulting type after applying the +
operator.
fn add(self, other: PrivateKey) -> Option<PrivateKey>
[src]
impl Mul<PrivateKey> for Message
[src]
type Output = Option<Message>
The resulting type after applying the *
operator.
fn mul(self, sk: PrivateKey) -> Option<Message>
[src]
impl Mul<PrivateKey> for PublicKey
[src]
type Output = Option<PublicKey>
The resulting type after applying the *
operator.
fn mul(self, sk: PrivateKey) -> Option<PublicKey>
[src]
impl Debug for PrivateKey
[src]
Auto Trait Implementations
impl Send for PrivateKey
impl Sync for PrivateKey
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self