pub struct DsaPrivateKey { /* private fields */ }Expand description
Private key for DSA.
Implementations§
Source§impl DsaPrivateKey
impl DsaPrivateKey
Sourcepub fn subgroup_order(&self) -> &BigUint
pub fn subgroup_order(&self) -> &BigUint
Return the prime subgroup order.
Sourcepub fn to_public_key(&self) -> DsaPublicKey
pub fn to_public_key(&self) -> DsaPublicKey
Derive the matching public key from this private key.
Sourcepub fn sign_digest_with_nonce(
&self,
digest: &[u8],
nonce: &BigUint,
) -> Option<DsaSignature>
pub fn sign_digest_with_nonce( &self, digest: &[u8], nonce: &BigUint, ) -> Option<DsaSignature>
Sign with an explicit nonce k.
DSA uses a fresh k in [1, q) for every signature. This lower-level
entry point keeps the arithmetic explicit for deterministic tests.
Reusing the same k for two different messages with the same key
immediately reveals the private exponent. Outside of fixed vectors,
prefer Self::sign_digest or Self::sign_message.
Sourcepub fn sign_digest<H: Digest>(&self, digest: &[u8]) -> Option<DsaSignature>
pub fn sign_digest<H: Digest>(&self, digest: &[u8]) -> Option<DsaSignature>
Sign a pre-hashed digest using RFC 6979 deterministic nonce derivation.
Sourcepub fn sign_digest_with_rng<R: Csprng>(
&self,
digest: &[u8],
rng: &mut R,
) -> Option<DsaSignature>
pub fn sign_digest_with_rng<R: Csprng>( &self, digest: &[u8], rng: &mut R, ) -> Option<DsaSignature>
Sign a digest using a fresh random nonce.
Sourcepub fn sign_message<H: Digest>(&self, message: &[u8]) -> Option<DsaSignature>
pub fn sign_message<H: Digest>(&self, message: &[u8]) -> Option<DsaSignature>
Hash one message with H, then sign deterministically.
Sourcepub fn sign_message_with_rng<H: Digest, R: Csprng>(
&self,
message: &[u8],
rng: &mut R,
) -> Option<DsaSignature>
pub fn sign_message_with_rng<H: Digest, R: Csprng>( &self, message: &[u8], rng: &mut R, ) -> Option<DsaSignature>
Hash one message with H, then sign with randomized nonces.
Sourcepub fn sign_digest_bytes<H: Digest>(&self, digest: &[u8]) -> Option<Vec<u8>>
pub fn sign_digest_bytes<H: Digest>(&self, digest: &[u8]) -> Option<Vec<u8>>
Sign a digest deterministically and return serialized signature bytes.
Sourcepub fn sign_digest_bytes_with_rng<H: Digest, R: Csprng>(
&self,
digest: &[u8],
rng: &mut R,
) -> Option<Vec<u8>>
pub fn sign_digest_bytes_with_rng<H: Digest, R: Csprng>( &self, digest: &[u8], rng: &mut R, ) -> Option<Vec<u8>>
Sign a digest with randomized nonces and return serialized signature bytes.
Sourcepub fn sign_message_bytes<H: Digest>(&self, message: &[u8]) -> Option<Vec<u8>>
pub fn sign_message_bytes<H: Digest>(&self, message: &[u8]) -> Option<Vec<u8>>
Hash one message with H, then sign and serialize deterministically.
Sourcepub fn sign_message_bytes_with_rng<H: Digest, R: Csprng>(
&self,
message: &[u8],
rng: &mut R,
) -> Option<Vec<u8>>
pub fn sign_message_bytes_with_rng<H: Digest, R: Csprng>( &self, message: &[u8], rng: &mut R, ) -> Option<Vec<u8>>
Hash one message with H, then sign and serialize with randomized nonces.
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.
Sourcepub fn from_key_blob(blob: &[u8]) -> Option<Self>
pub fn from_key_blob(blob: &[u8]) -> Option<Self>
Decode the private key from the crate-defined binary format.
Trait Implementations§
Source§impl Clone for DsaPrivateKey
impl Clone for DsaPrivateKey
Source§fn clone(&self) -> DsaPrivateKey
fn clone(&self) -> DsaPrivateKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DsaPrivateKey
impl Debug for DsaPrivateKey
Source§impl PartialEq for DsaPrivateKey
impl PartialEq for DsaPrivateKey
Source§fn eq(&self, other: &DsaPrivateKey) -> bool
fn eq(&self, other: &DsaPrivateKey) -> bool
self and other values to be equal, and is used by ==.