pub struct PublicKey(/* private fields */);Expand description
An ECDH public key: a point on the curve.
Parsing does not validate the point; the ECDH driver does, when it
is used. Convert to a Point to validate it explicitly.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn from_sec1(bytes: &[u8; 65]) -> Result<Self, Error>
pub fn from_sec1(bytes: &[u8; 65]) -> Result<Self, Error>
Parse an uncompressed SEC1 encoding (0x04 || x || y).
Sourcepub fn from_sec1_compressed(bytes: &[u8; 33]) -> Result<Self, Error>
pub fn from_sec1_compressed(bytes: &[u8; 33]) -> Result<Self, Error>
Parse a compressed SEC1 encoding (0x02 || x or 0x03 || x).
Unlike the uncompressed form, this does validate the point: decompression fails for an X coordinate not on the curve.
Sourcepub fn to_sec1_compressed(&self) -> [u8; 33]
pub fn to_sec1_compressed(&self) -> [u8; 33]
The compressed SEC1 encoding (0x02 || x or 0x03 || x).
Trait Implementations§
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Forget for PublicKey
impl Freeze for PublicKey
impl Move 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