Struct p256_cortex_m4::PublicKey
source · pub struct PublicKey { /* private fields */ }
Expand description
NIST P-256 public key.
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub fn from_untagged_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_untagged_bytes(bytes: &[u8]) -> Result<Self>
Decode assuming bytes
is x-coordinate then y-coordinate, both big-endian 32B arrays.
In other words, the uncompressed SEC1 format, without the leading 0x04 byte tag.
sourcepub fn from_sec1_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_sec1_bytes(bytes: &[u8]) -> Result<Self>
Decode PublicKey
(compressed or uncompressed) from the
Elliptic-Curve-Point-to-Octet-String
encoding in SEC 1 (section 2.3.3)
This is the left-inverse of both to_compressed_bytes
and to_uncompressed_bytes
.
sourcepub fn to_untagged_bytes(&self) -> [u8; 64]
pub fn to_untagged_bytes(&self) -> [u8; 64]
Raw encoding, x-coordinate then y-coordinate.
sourcepub fn to_compressed_sec1_bytes(&self) -> [u8; 33]
pub fn to_compressed_sec1_bytes(&self) -> [u8; 33]
Compressed encoding: 02 || Px
if Py is even and 03 || Px
if Py is odd
sourcepub fn to_uncompressed_sec1_bytes(&self) -> [u8; 65]
pub fn to_uncompressed_sec1_bytes(&self) -> [u8; 65]
Uncompressed encoding: 04 || Px || Py
.
sourcepub fn verify_prehashed(
&self,
prehashed_message: &[u8],
signature: &Signature
) -> bool
pub fn verify_prehashed( &self, prehashed_message: &[u8], signature: &Signature ) -> bool
Verify signature on message assumed to be hashed, if needed.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin 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