pub struct EcdsaPublicKey { /* private fields */ }Expand description
Public key for ECDSA.
Stores the curve parameters and the public point Q = d·G.
Implementations§
Source§impl EcdsaPublicKey
impl EcdsaPublicKey
Sourcepub fn curve(&self) -> &CurveParams
pub fn curve(&self) -> &CurveParams
The curve parameters for this key.
Sourcepub fn public_point(&self) -> &AffinePoint
pub fn public_point(&self) -> &AffinePoint
The public point Q = d·G.
Sourcepub fn to_wire_bytes(&self) -> Vec<u8> ⓘ
pub fn to_wire_bytes(&self) -> Vec<u8> ⓘ
Encode the public point as a compact SEC 1 point string.
Sourcepub fn from_wire_bytes(curve: CurveParams, bytes: &[u8]) -> Option<Self>
pub fn from_wire_bytes(curve: CurveParams, bytes: &[u8]) -> Option<Self>
Rebuild a public key from a compact SEC 1 point string plus explicit curve parameters.
Sourcepub fn verify_message<H: Digest>(
&self,
message: &[u8],
signature: &EcdsaSignature,
) -> bool
pub fn verify_message<H: Digest>( &self, message: &[u8], signature: &EcdsaSignature, ) -> bool
Convenience: hashes message with H then calls verify.
Sourcepub fn verify_message_bytes<H: Digest>(
&self,
message: &[u8],
signature: &[u8],
) -> bool
pub fn verify_message_bytes<H: Digest>( &self, message: &[u8], signature: &[u8], ) -> bool
Convenience: hashes message with H then calls verify_bytes.
Sourcepub fn verify(&self, digest: &[u8], signature: &EcdsaSignature) -> bool
pub fn verify(&self, digest: &[u8], signature: &EcdsaSignature) -> bool
Verify signature over a raw digest byte string.
The digest is reduced to a scalar representative matching FIPS 186-5
(leftmost bits(n) bits of the hash output).
Sourcepub fn verify_digest_scalar(
&self,
hash: &BigUint,
signature: &EcdsaSignature,
) -> bool
pub fn verify_digest_scalar( &self, hash: &BigUint, signature: &EcdsaSignature, ) -> bool
Core ECDSA verification over a pre-reduced scalar z.
Sourcepub fn verify_bytes(&self, digest: &[u8], signature: &[u8]) -> bool
pub fn verify_bytes(&self, digest: &[u8], signature: &[u8]) -> bool
Verify a byte-encoded signature produced by [EcdsaPrivateKey::sign_bytes].
Sourcepub fn to_key_blob(&self) -> Vec<u8> ⓘ
pub fn to_key_blob(&self) -> Vec<u8> ⓘ
Encode the public key in the crate-defined binary format.
Layout: one field-type byte (0x00 = prime, 0x01 = binary) followed
by [p, a, b, n, h, Gx, Gy, Qx, Qy] as a DER SEQUENCE of positive
INTEGERs.
Sourcepub fn from_key_blob(blob: &[u8]) -> Option<Self>
pub fn from_key_blob(blob: &[u8]) -> Option<Self>
Decode a public key from the crate-defined binary format.
pub fn to_pem(&self) -> String
Sourcepub fn from_pem(pem: &str) -> Option<Self>
pub fn from_pem(pem: &str) -> Option<Self>
Returns None if the PEM label does not match or the payload is malformed.
Trait Implementations§
Source§impl Clone for EcdsaPublicKey
impl Clone for EcdsaPublicKey
Source§fn clone(&self) -> EcdsaPublicKey
fn clone(&self) -> EcdsaPublicKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more