Skip to main content

HostMacKeyWithStore

Trait HostMacKeyWithStore 

Source
pub trait HostMacKeyWithStore<T>: HasData + Send {
    // Required methods
    fn drop(
        accessor: &Accessor<T, Self>,
        rep: Resource<MacKey>,
    ) -> impl Future<Output = Result<()>> + Send
       where Self: Sized;
    fn sign(
        accessor: &Accessor<T, Self>,
        self_: Resource<MacKey>,
        data: StreamReader<u8>,
    ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send;
    fn verify(
        accessor: &Accessor<T, Self>,
        self_: Resource<MacKey>,
        data: StreamReader<u8>,
        tag: Vec<u8>,
    ) -> impl Future<Output = Result<Result<(), Error>>> + Send;
    fn export_key_raw(
        accessor: &Accessor<T, Self>,
        self_: Resource<MacKey>,
    ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send;
    fn export_key_jwk(
        accessor: &Accessor<T, Self>,
        self_: Resource<MacKey>,
    ) -> impl Future<Output = Result<Result<String, Error>>> + Send;
    fn to_wrap_input_raw(
        accessor: &Accessor<T, Self>,
        self_: Resource<MacKey>,
    ) -> impl Future<Output = Result<Result<Resource<WrapInput>, Error>>> + Send;
    fn to_wrap_input_jwk(
        accessor: &Accessor<T, Self>,
        self_: Resource<MacKey>,
    ) -> impl Future<Output = Result<Result<Resource<WrapInput>, Error>>> + Send;
}

Required Methods§

Source

fn drop( accessor: &Accessor<T, Self>, rep: Resource<MacKey>, ) -> impl Future<Output = Result<()>> + Send
where Self: Sized,

Source

fn sign( accessor: &Accessor<T, Self>, self_: Resource<MacKey>, data: StreamReader<u8>, ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send

Compute the authentication tag over an entire byte stream keyed by this key. A success resolves only after the stream is fully drained (its writer dropped).

Fails only for operational reasons (error.other).

Source

fn verify( accessor: &Accessor<T, Self>, self_: Resource<MacKey>, data: StreamReader<u8>, tag: Vec<u8>, ) -> impl Future<Output = Result<Result<(), Error>>> + Send

Verify tag against the tag computed over an entire byte stream keyed by this key, in constant time. Both verdicts — ok and error.authentication-failed — are computed over the entire stream and resolve only after it is fully drained.

Fails with error.authentication-failed if the tag does not verify. Returns a result, not a bool: an ignored boolean fails open, a dropped result does not.

Source

fn export_key_raw( accessor: &Accessor<T, Self>, self_: Resource<MacKey>, ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send

The raw key material. Fails with error.not-extractable unless the key was created with extractable true.

Source

fn export_key_jwk( accessor: &Accessor<T, Self>, self_: Resource<MacKey>, ) -> impl Future<Output = Result<Result<String, Error>>> + Send

The key as an RFC 7517 JSON Web Key, behind the same extractability gate as export-key-raw. See README.md, “JWK contract”.

Source

fn to_wrap_input_raw( accessor: &Accessor<T, Self>, self_: Resource<MacKey>, ) -> impl Future<Output = Result<Result<Resource<WrapInput>, Error>>> + Send

This key’s raw material as a wrap-input, for wrapping under another key (see the wrapping interface). Behind the same extractability gate as export-key-raw; the material itself never reaches the caller.

Source

fn to_wrap_input_jwk( accessor: &Accessor<T, Self>, self_: Resource<MacKey>, ) -> impl Future<Output = Result<Result<Resource<WrapInput>, Error>>> + Send

The JWK serialization as a wrap-input, behind the same gate. See README.md, “JWK contract”.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§