Struct sm2::dsa::VerifyingKey
source · pub struct VerifyingKey { /* private fields */ }
arithmetic
and dsa
only.Expand description
SM2DSA public key used for verifying signatures are valid for a given message.
Usage
The signature
crate defines the following traits which are the
primary API for verifying:
Verifier
: verify a message against a provided key and signaturePrehashVerifier
: verify the low-level raw output bytes of a message digest
serde
support
When the serde
feature of this crate is enabled, it provides support for
serializing and deserializing ECDSA signatures using the Serialize
and
Deserialize
traits.
The serialization leverages the encoding used by the PublicKey
type,
which is a binary-oriented ASN.1 DER encoding.
Implementations§
source§impl VerifyingKey
impl VerifyingKey
sourcepub fn new(distid: &str, public_key: PublicKey) -> Result<Self>
pub fn new(distid: &str, public_key: PublicKey) -> Result<Self>
Initialize VerifyingKey
from a signer’s distinguishing identifier
and public key.
sourcepub fn from_sec1_bytes(distid: &str, bytes: &[u8]) -> Result<Self>
pub fn from_sec1_bytes(distid: &str, bytes: &[u8]) -> Result<Self>
Initialize VerifyingKey
from a SEC1-encoded public key.
sourcepub fn from_affine(distid: &str, affine: AffinePoint) -> Result<Self>
pub fn from_affine(distid: &str, affine: AffinePoint) -> Result<Self>
Initialize VerifyingKey
from an affine point.
Returns an Error
if the given affine point is the additive identity
(a.k.a. point at infinity).
sourcepub fn as_affine(&self) -> &AffinePoint
pub fn as_affine(&self) -> &AffinePoint
Borrow the inner AffinePoint
for this public key.
sourcepub fn distid(&self) -> &str
Available on crate feature alloc
only.
pub fn distid(&self) -> &str
alloc
only.Get the distinguishing identifier for this key.
sourcepub fn to_sec1_bytes(&self) -> Box<[u8]>
Available on crate feature alloc
only.
pub fn to_sec1_bytes(&self) -> Box<[u8]>
alloc
only.Convert this VerifyingKey
into the
Elliptic-Curve-Point-to-Octet-String
encoding described in
SEC 1: Elliptic Curve Cryptography (Version 2.0) section 2.3.3
(page 10).
Trait Implementations§
source§impl AsRef<AffinePoint<Sm2>> for VerifyingKey
impl AsRef<AffinePoint<Sm2>> for VerifyingKey
source§fn as_ref(&self) -> &AffinePoint
fn as_ref(&self) -> &AffinePoint
source§impl AsRef<VerifyingKey> for SigningKey
impl AsRef<VerifyingKey> for SigningKey
source§fn as_ref(&self) -> &VerifyingKey
fn as_ref(&self) -> &VerifyingKey
source§impl Clone for VerifyingKey
impl Clone for VerifyingKey
source§fn clone(&self) -> VerifyingKey
fn clone(&self) -> VerifyingKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for VerifyingKey
impl Debug for VerifyingKey
source§impl From<&VerifyingKey> for PublicKey
impl From<&VerifyingKey> for PublicKey
source§fn from(verifying_key: &VerifyingKey) -> PublicKey
fn from(verifying_key: &VerifyingKey) -> PublicKey
source§impl From<VerifyingKey> for PublicKey
impl From<VerifyingKey> for PublicKey
source§fn from(verifying_key: VerifyingKey) -> PublicKey
fn from(verifying_key: VerifyingKey) -> PublicKey
source§impl PrehashVerifier<Signature> for VerifyingKey
impl PrehashVerifier<Signature> for VerifyingKey
source§impl ToEncodedPoint<Sm2> for VerifyingKey
impl ToEncodedPoint<Sm2> for VerifyingKey
source§fn to_encoded_point(&self, compress: bool) -> EncodedPoint
fn to_encoded_point(&self, compress: bool) -> EncodedPoint
EncodedPoint
, optionally applying
point compression.