Skip to main content

Context

Struct Context 

Source
pub struct Context<'k, 'v, K> {
    pub(crate) key: &'k K,
    pub(crate) value: &'v [u8],
}
Expand description

Ed448 contexts as used by Ed448ph.

Contexts are domain separator strings that can be used to isolate uses of the algorithm between different protocols (which is very hard to reliably do otherwise) and between different uses within the same protocol.

To create a context, call either of the following:

Fields§

§key: &'k K§value: &'v [u8]

Implementations§

Source§

impl<'k, 'v, K> Context<'k, 'v, K>

Source

pub const MAX_LENGTH: usize = 255

Maximum length of a context string.

Source

pub fn key(&self) -> &'k K

Borrow the key

Source

pub fn value(&self) -> &'v [u8]

Borrow the value

Trait Implementations§

Source§

impl<'k, 'v, K: Clone> Clone for Context<'k, 'v, K>

Source§

fn clone(&self) -> Context<'k, 'v, K>

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<'k, 'v, K: Debug> Debug for Context<'k, 'v, K>

Source§

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

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

impl<D> DigestSigner<D, Signature> for Context<'_, '_, SigningKey>

Source§

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

Attempt to sign a message by updating the received Digest with it, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign_digest<F>(&self, f: F) -> S
where F: Fn(&mut D),

Sign a message by updating the received Digest with it, returning a signature. Read more
Source§

impl<D> DigestVerifier<D, Signature> for Context<'_, '_, VerifyingKey>

Source§

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

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

impl PrehashSigner<Signature> for Context<'_, '_, SigningKey>

Source§

fn sign_prehash(&self, prehash: &[u8]) -> Result<Signature, Error>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
Source§

impl Signer<Signature> for Context<'_, '_, SigningKey>

Source§

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

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature.
Source§

impl Verifier<Signature> for Context<'_, '_, VerifyingKey>

Source§

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

Use Self (e.g. a verifying key) to verify that the provided signature is authentic for a given message bytestring. Read more
Source§

impl<'k, 'v, K: Copy> Copy for Context<'k, 'v, K>

Auto Trait Implementations§

§

impl<'k, 'v, K> Freeze for Context<'k, 'v, K>

§

impl<'k, 'v, K> RefUnwindSafe for Context<'k, 'v, K>
where K: RefUnwindSafe,

§

impl<'k, 'v, K> Send for Context<'k, 'v, K>
where K: Sync,

§

impl<'k, 'v, K> Sync for Context<'k, 'v, K>
where K: Sync,

§

impl<'k, 'v, K> Unpin for Context<'k, 'v, K>

§

impl<'k, 'v, K> UnsafeUnpin for Context<'k, 'v, K>

§

impl<'k, 'v, K> UnwindSafe for Context<'k, 'v, K>
where K: RefUnwindSafe,

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<S, T> AsyncSigner<S> for T
where T: Signer<S>,

Source§

async fn sign_async(&self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
Source§

impl<S, T> AsyncVerifier<S> for T
where T: Verifier<S>,

Source§

async fn verify_async(&self, msg: &[u8], signature: &S) -> Result<(), Error>

Asynchronously verify that the provided signature for a given message bytestring is authentic. 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> 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.