pub struct PublicKey { /* private fields */ }Expand description
Implementations§
Source§impl PublicKey
impl PublicKey
pub fn from_bytes(key: &[u8]) -> Result<PublicKey, EllipticCurveError>
Sourcepub fn from_x_y(
x_bytes: &[u8; 32],
y_bytes: &[u8; 32],
) -> Result<PublicKey, EllipticCurveError>
pub fn from_x_y( x_bytes: &[u8; 32], y_bytes: &[u8; 32], ) -> Result<PublicKey, EllipticCurveError>
Build a public key from raw affine x and y coordinates (both
big-endian, 32 bytes each). Returns InvalidKey if the coordinates
are not a valid point on the P-256 curve.
This is useful when importing keys from formats like JWK where x
and y are available directly.
pub fn verify( &self, message: &[u8], signature: &[u8; 64], ) -> Result<(), EllipticCurveError>
pub fn to_bytes(&self) -> [u8; 65]
Trait Implementations§
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
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