pub struct EcdsaP256PublicKey(/* private fields */);Expand description
A DER-encoded ECDSA P-256 public key (PKIX SubjectPublicKeyInfo).
Stores the full DER encoding so ring::signature::UnparsedPublicKey
can consume it directly.
Usage:
ⓘ
let pk = EcdsaP256PublicKey::from_der(&der_bytes)?;Implementations§
Source§impl EcdsaP256PublicKey
impl EcdsaP256PublicKey
Sourcepub fn from_der(der: &[u8]) -> Result<Self, EcdsaP256Error>
pub fn from_der(der: &[u8]) -> Result<Self, EcdsaP256Error>
Creates from DER-encoded PKIX SubjectPublicKeyInfo bytes.
Performs minimal validation: checks the ASN.1 OID prefix for P-256
(06 08 2a 86 48 ce 3d 03 01 07).
Sourcepub fn as_sec1_uncompressed(&self) -> Option<&[u8]>
pub fn as_sec1_uncompressed(&self) -> Option<&[u8]>
Returns the public key as a raw uncompressed SEC1 point
(0x04 || X || Y, 65 bytes).
This is the form ring’s ECDSA_P256_SHA256_ASN1 verifier consumes — it
does NOT accept the DER SPKI returned by Self::as_der. For a
well-formed P-256 SPKI the point is the trailing 65 bytes (the BIT STRING
value, sans its 0x00 unused-bits prefix). Returns None for a
compressed or malformed key.
Usage:
ⓘ
let point = key.as_sec1_uncompressed().ok_or(/* malformed */)?;
let verifier = UnparsedPublicKey::new(&ECDSA_P256_SHA256_ASN1, point);Trait Implementations§
Source§impl Clone for EcdsaP256PublicKey
impl Clone for EcdsaP256PublicKey
Source§fn clone(&self) -> EcdsaP256PublicKey
fn clone(&self) -> EcdsaP256PublicKey
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 EcdsaP256PublicKey
impl Debug for EcdsaP256PublicKey
Source§impl<'de> Deserialize<'de> for EcdsaP256PublicKey
impl<'de> Deserialize<'de> for EcdsaP256PublicKey
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EcdsaP256PublicKey
Source§impl PartialEq for EcdsaP256PublicKey
impl PartialEq for EcdsaP256PublicKey
Source§fn eq(&self, other: &EcdsaP256PublicKey) -> bool
fn eq(&self, other: &EcdsaP256PublicKey) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for EcdsaP256PublicKey
impl Serialize for EcdsaP256PublicKey
impl StructuralPartialEq for EcdsaP256PublicKey
Auto Trait Implementations§
impl Freeze for EcdsaP256PublicKey
impl RefUnwindSafe for EcdsaP256PublicKey
impl Send for EcdsaP256PublicKey
impl Sync for EcdsaP256PublicKey
impl Unpin for EcdsaP256PublicKey
impl UnsafeUnpin for EcdsaP256PublicKey
impl UnwindSafe for EcdsaP256PublicKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.