Ed448VerifyingKey

Struct Ed448VerifyingKey 

Source
pub struct Ed448VerifyingKey { /* private fields */ }
Expand description

Ed448 public key as defined in [RFC8032 § 5.2.5]

Implementations§

Source§

impl VerifyingKey

Source

pub fn to_bytes(&self) -> [u8; 57]

Convert this verifying key into byte slice

Source

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

View this public key as a byte slice.

Source

pub fn from_bytes(bytes: &[u8; 57]) -> Result<VerifyingKey, Error>

Construct a VerifyingKey from a slice of bytes.

Source

pub fn with_context<'k, 'v>( &'k self, context: &'v [u8], ) -> Context<'k, 'v, VerifyingKey>

Create a context for this verifying key that can be used with signature::DigestVerifier.

Source

pub fn to_edwards(self) -> EdwardsPoint

Return the verifying key in Edwards form.

Source

pub fn verify_raw( &self, signature: &Signature, message: &[u8], ) -> Result<(), Error>

Verifies a signature on a message.

This is the “Ed448” mode of RFC 8032 (no pre-hashing, a context is provided). This is equivalent to verify_ctx() with an empty (zero-length) context.

Note: this function is not constant-time; it assumes that the public key and signature value are public data.

Source

pub fn verify_ctx( self, sig: &Signature, ctx: &[u8], message: &[u8], ) -> Result<(), Error>

Verifies a signature on a message (with context).

This is the “Ed448” mode of RFC 8032 (no pre-hashing, a context is provided). The context string MUST have length at most 255 bytes. Return value is Ok on a valid signature, Error otherwise.

Note: this function is not constant-time; it assumes that the public key and signature value are public data.

Source

pub fn verify_prehashed<D>( self, sig: &Signature, ctx: Option<&[u8]>, prehashed_message: D, ) -> Result<(), Error>
where D: PreHash,

Verifies a signature on a hashed message.

This is the “Ed448ph” mode of RFC 8032 (message is pre-hashed), also known as “HashEdDSA on Curve448”. The hashed message prehashed_message is provided (presumably, that hash value was obtained with SHAKE256 and a 64-byte output; the caller does the hashing itself). A context string ctx is also provided; it MUST have length at most 255 bytes. Return value is Ok on a valid signature, Error otherwise.

Note: this function is not constant-time; it assumes that the public key and signature value are public data.

Trait Implementations§

Source§

impl AsRef<[u8]> for VerifyingKey

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for VerifyingKey

Source§

fn clone(&self) -> VerifyingKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerifyingKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for VerifyingKey

Source§

fn default() -> VerifyingKey

Returns the “default value” for a type. Read more
Source§

impl<D> DigestVerifier<D, Signature> for VerifyingKey
where D: Digest + Update,

Source§

fn verify_digest<F>(&self, f: F, signature: &Signature) -> Result<(), Error>
where F: Fn(&mut D) -> Result<(), Error>,

Verify the signature against the received Digest output, by updating it with the message. Read more
Source§

impl DynSignatureAlgorithmIdentifier for VerifyingKey

Source§

fn signature_algorithm_identifier( &self, ) -> Result<AlgorithmIdentifier<Any>, Error>

AlgorithmIdentifier for the corresponding signature system.
Source§

impl EncodePublicKey for VerifyingKey

Source§

fn to_public_key_der(&self) -> Result<Document, Error>

Serialize a Document containing a SPKI-encoded public key.
Source§

fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>

Serialize this public key as PEM-encoded SPKI with the given LineEnding.
Source§

fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>

Write ASN.1 DER-encoded public key to the given path
Source§

fn write_public_key_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding, ) -> Result<(), Error>

Write ASN.1 PEM-encoded public key to the given path
Source§

impl Hash for VerifyingKey

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for VerifyingKey

Source§

fn eq(&self, other: &VerifyingKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&PublicKeyBytes> for VerifyingKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( value: &PublicKeyBytes, ) -> Result<VerifyingKey, <VerifyingKey as TryFrom<&PublicKeyBytes>>::Error>

Performs the conversion.
Source§

impl TryFrom<PublicKeyBytes> for VerifyingKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( value: PublicKeyBytes, ) -> Result<VerifyingKey, <VerifyingKey as TryFrom<PublicKeyBytes>>::Error>

Performs the conversion.
Source§

impl TryFrom<SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for VerifyingKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( public_key: SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>, ) -> Result<VerifyingKey, Error>

Performs the conversion.
Source§

impl Verifier<Signature> for VerifyingKey

Source§

fn verify(&self, msg: &[u8], signature: &Signature) -> Result<(), Error>

Use Self to verify that the provided signature for a given message bytestring is authentic. Read more
Source§

impl VerifyingKey for Ed448VerifyingKey

Source§

fn verifies(&self, signature: &[u8], message: &[u8]) -> bool

Returns if this key verifies the message to match the signature.
Source§

fn raw_public_key(&self) -> Vec<u8>

Get this key’s raw public key representation.
Source§

fn from_raw_public_key(bytes: &[u8]) -> Option<Self>
where Self: Sized,

Create a verifying key from a raw public key.
Source§

fn from_spki_der(der: &[u8]) -> Option<Self>
where Self: Sized,

Create a new key from a subject public key info der.
Source§

fn curve_oid(&self) -> ObjectIdentifier

Get the object identifier of the curve.
Source§

impl Copy for VerifyingKey

Source§

impl Eq for VerifyingKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DecodePublicKey for T
where T: for<'a> TryFrom<SubjectPublicKeyInfo<AnyRef<'a>, BitStringRef<'a>>, Error = Error>,

Source§

fn from_public_key_der(bytes: &[u8]) -> Result<T, Error>

Deserialize object from ASN.1 DER-encoded [SubjectPublicKeyInfo] (binary format).
Source§

fn from_public_key_pem(s: &str) -> Result<Self, Error>

Deserialize PEM-encoded [SubjectPublicKeyInfo]. Read more
Source§

fn read_public_key_der_file(path: impl AsRef<Path>) -> Result<Self, Error>

Load public key object from an ASN.1 DER-encoded file on the local filesystem (binary format).
Source§

fn read_public_key_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>

Load public key object from a PEM-encoded file on the local filesystem.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V