pub struct PublicKey {
pub bytes: Vec<u8>,
}Expand description
Public key on a short Weierstrass curve: an SEC1-encoded point
(uncompressed 0x04 || X || Y or compressed 0x02/0x03 || X).
Shared between ECDSA and ECDH on the same curve: there is no “ECDH-only” or “ECDSA-only” key type.
Fields§
§bytes: Vec<u8>SEC1-encoded curve point.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn to_spki_der(&self, curve: EcCurve) -> Vec<u8> ⓘ
pub fn to_spki_der(&self, curve: EcCurve) -> Vec<u8> ⓘ
Encode as SubjectPublicKeyInfo DER (RFC 5480).
Sourcepub fn from_spki_der(der: &[u8]) -> Option<(Self, EcCurve)>
pub fn from_spki_der(der: &[u8]) -> Option<(Self, EcCurve)>
Parse from SubjectPublicKeyInfo DER. Returns (key, curve).
Sourcepub fn to_spki_pem(&self, curve: EcCurve) -> String
pub fn to_spki_pem(&self, curve: EcCurve) -> String
Encode as SPKI PEM.
Sourcepub fn from_spki_pem(pem: &str) -> Option<(Self, EcCurve)>
pub fn from_spki_pem(pem: &str) -> Option<(Self, EcCurve)>
Parse from SPKI PEM.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnsafeUnpin for PublicKey
impl UnwindSafe for PublicKey
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