pub struct EdDsaPrivateKey { /* private fields */ }Expand description
Private key for the Edwards-curve signature layer.
Implementations§
Source§impl EdDsaPrivateKey
impl EdDsaPrivateKey
Sourcepub fn curve(&self) -> &TwistedEdwardsCurve
pub fn curve(&self) -> &TwistedEdwardsCurve
Return the curve parameters.
Sourcepub fn private_scalar(&self) -> &BigUint
pub fn private_scalar(&self) -> &BigUint
Return the private scalar d ∈ [1, n).
Sourcepub fn public_point(&self) -> &EdwardsPoint
pub fn public_point(&self) -> &EdwardsPoint
Return the cached public point A = d·G.
Sourcepub fn to_public_key(&self) -> EdDsaPublicKey
pub fn to_public_key(&self) -> EdDsaPublicKey
Derive the matching public key A = d·G.
Sourcepub fn sign_message_with_nonce<H: Digest>(
&self,
message: &[u8],
nonce: &BigUint,
) -> Option<EdDsaSignature>
pub fn sign_message_with_nonce<H: Digest>( &self, message: &[u8], nonce: &BigUint, ) -> Option<EdDsaSignature>
Sign with an explicit nonce scalar k.
Reusing the same nonce with the same private key leaks the secret scalar from two signatures, so this entry point is for deterministic tests and fixed vectors only.
Sourcepub fn sign_message<H: Digest, R: Csprng>(
&self,
message: &[u8],
rng: &mut R,
) -> Option<EdDsaSignature>
pub fn sign_message<H: Digest, R: Csprng>( &self, message: &[u8], rng: &mut R, ) -> Option<EdDsaSignature>
Sign using a fresh random nonce.
Sourcepub fn sign_message_bytes<H: Digest, R: Csprng>(
&self,
message: &[u8],
rng: &mut R,
) -> Option<Vec<u8>>
pub fn sign_message_bytes<H: Digest, R: Csprng>( &self, message: &[u8], rng: &mut R, ) -> Option<Vec<u8>>
Sign and serialize in one step.
Sourcepub fn to_key_blob(&self) -> Vec<u8> ⓘ
pub fn to_key_blob(&self) -> Vec<u8> ⓘ
Encode the private key in the crate-defined binary format.
Field layout: [p, a, d, n, Gx, Gy, private].
Sourcepub fn from_key_blob(blob: &[u8]) -> Option<Self>
pub fn from_key_blob(blob: &[u8]) -> Option<Self>
Decode a private key from the crate-defined binary format.
pub fn to_pem(&self) -> String
pub fn from_pem(pem: &str) -> Option<Self>
pub fn to_xml(&self) -> String
pub fn from_xml(xml: &str) -> Option<Self>
Trait Implementations§
Source§impl Clone for EdDsaPrivateKey
impl Clone for EdDsaPrivateKey
Source§fn clone(&self) -> EdDsaPrivateKey
fn clone(&self) -> EdDsaPrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EdDsaPrivateKey
impl Debug for EdDsaPrivateKey
Source§impl PartialEq for EdDsaPrivateKey
impl PartialEq for EdDsaPrivateKey
impl Eq for EdDsaPrivateKey
Auto Trait Implementations§
impl Freeze for EdDsaPrivateKey
impl RefUnwindSafe for EdDsaPrivateKey
impl Send for EdDsaPrivateKey
impl Sync for EdDsaPrivateKey
impl Unpin for EdDsaPrivateKey
impl UnsafeUnpin for EdDsaPrivateKey
impl UnwindSafe for EdDsaPrivateKey
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