pub struct PublicKey<C: Curve> { /* private fields */ }Expand description
An ECDSA public key over the given curve.
Implementations§
Source§impl<C: Curve> PublicKey<C>
impl<C: Curve> PublicKey<C>
Sourcepub fn from_x962_uncompressed(x962: &[u8]) -> Option<Self>
pub fn from_x962_uncompressed(x962: &[u8]) -> Option<Self>
Parse a public key in uncompressed X9.62 format. (This is the common format for elliptic curve points beginning with an 0x04 byte.)
Sourcepub fn to_x962_uncompressed(&self) -> Buffer
pub fn to_x962_uncompressed(&self) -> Buffer
Serialize this key as uncompressed X9.62 format.
Sourcepub fn from_x962_compressed(x962: &[u8]) -> Option<Self>
pub fn from_x962_compressed(x962: &[u8]) -> Option<Self>
Parse a public key in compressed X9.62 point format.
Sourcepub fn to_x962_compressed(&self) -> Buffer
pub fn to_x962_compressed(&self) -> Buffer
Serialize this key as compressed X9.62 format.
WARNING: compressed form is rarely used and is not as well supported as the uncompressed form.
Sourcepub fn from_der_subject_public_key_info(spki: &[u8]) -> Option<Self>
pub fn from_der_subject_public_key_info(spki: &[u8]) -> Option<Self>
Parse a public key in SubjectPublicKeyInfo format. (This is found in, e.g., X.509 certificates.)
Sourcepub fn to_der_subject_public_key_info(&self) -> Buffer
pub fn to_der_subject_public_key_info(&self) -> Buffer
Serialize this key in SubjectPublicKeyInfo format.
Sourcepub fn verify(
&self,
signed_msg: &[u8],
signature: &[u8],
) -> Result<(), InvalidSignatureError>
pub fn verify( &self, signed_msg: &[u8], signature: &[u8], ) -> Result<(), InvalidSignatureError>
Verify signature as a valid ASN.1-based signature of a digest of
signed_msg with this public key. SHA-256 will be used to produce the
digest if the curve of this public key is P-256. SHA-384 will be used to
produce the digest if the curve of this public key is P-384.
Sourcepub fn verify_p1363(
&self,
signed_msg: &[u8],
signature: &[u8],
) -> Result<(), InvalidSignatureError>
pub fn verify_p1363( &self, signed_msg: &[u8], signature: &[u8], ) -> Result<(), InvalidSignatureError>
Verify signature as a valid P1363-based signature of a digest of
signed_msg with this public key. SHA-256 will be used to produce the
digest if the curve of this public key is P-256. SHA-384 will be used to
produce the digest if the curve of this public key is P-384.