Struct nisty::PublicKey[][src]

pub struct PublicKey(_);

Public part of a keypair, a point on the curve. Verifies signatures.

Implementations

impl PublicKey[src]

pub fn verify(
    &self,
    message: &[u8],
    signature: impl AsArrayRef<[u8; 64]>
) -> bool
[src]

Verify that a claimed signature for a message is valid.

pub fn verify_prehashed(
    &self,
    prehashed_message: &[u8; 32],
    signature: impl AsArrayRef<[u8; 64]>
) -> bool
[src]

Verify that a claimed signature for a prehashed message is valid.

pub fn compress(&self) -> [u8; 33][src]

This is the “SEC1” representation of a point on an elliptic curve, which is often used in IETF protocols.

Reference: https://tools.ietf.org/html/rfc5480#section-2.2

The first byte contains 2 + the “sign” of the y-coordinate (least significant byte). The following 32 bytes are the x-coordinate in big-endian representation.

Note: The “uncompressed” SEC1 format would prepend byte 0x4, it seems in this case at least everyone uses “raw” encoding: x || y

impl PublicKey[src]

pub fn x_coordinate(&self) -> [u8; 32][src]

pub fn y_coordinate(&self) -> [u8; 32][src]

impl PublicKey[src]

pub fn try_from_bytes(public_key_bytes: &[u8; 64]) -> Result<Self>[src]

pub fn to_bytes(self) -> [u8; 64][src]

pub fn as_bytes(&self) -> &[u8; 64][src]

Trait Implementations

impl AsArrayRef<[u8; 64]> for PublicKey[src]

Serialization of public keys as byte array references.

impl AsArrayRef<[u8; 64]> for &PublicKey[src]

Serialization of public key references as byte array references.

impl Clone for PublicKey[src]

impl Copy for PublicKey[src]

impl Debug for PublicKey[src]

impl From<&'_ SecretKey> for PublicKey[src]

impl Into<[u8; 64]> for PublicKey[src]

Serialization of public keys into byte arrays.

impl PartialEq<PublicKey> for PublicKey[src]

impl TryFrom<&'_ [u8; 64]> for PublicKey[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl Send for PublicKey

impl Sync for PublicKey

impl Unpin for PublicKey

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.