Skip to main content

HostEncryptionKeyWithStore

Trait HostEncryptionKeyWithStore 

Source
pub trait HostEncryptionKeyWithStore<T>: HasData + Send {
    // Required methods
    fn drop(
        accessor: &Accessor<T, Self>,
        rep: Resource<EncryptionKey>,
    ) -> impl Future<Output = Result<()>> + Send
       where Self: Sized;
    fn encrypt(
        accessor: &Accessor<T, Self>,
        self_: Resource<EncryptionKey>,
        label: Option<Vec<u8>>,
        plaintext: Vec<u8>,
    ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send;
    fn wrap(
        accessor: &Accessor<T, Self>,
        self_: Resource<EncryptionKey>,
        label: Option<Vec<u8>>,
        input: Resource<WrapInput>,
    ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send;
    fn export_key_raw(
        accessor: &Accessor<T, Self>,
        self_: Resource<EncryptionKey>,
    ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send;
    fn export_key_spki(
        accessor: &Accessor<T, Self>,
        self_: Resource<EncryptionKey>,
    ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send;
    fn export_key_jwk(
        accessor: &Accessor<T, Self>,
        self_: Resource<EncryptionKey>,
    ) -> impl Future<Output = Result<Result<String, Error>>> + Send;
}

Required Methods§

Source

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

Source

fn encrypt( accessor: &Accessor<T, Self>, self_: Resource<EncryptionKey>, label: Option<Vec<u8>>, plaintext: Vec<u8>, ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send

Encrypt a plaintext bounded by the key. label is optional context bound into the padding: decryption succeeds only under the same label (WebCrypto’s RsaOaepParams.label). A plaintext above the key’s bound fails error.extension — origin "polymorph:webcrypto", name "message-too-long" — the signal to switch to hybrid wrapping (encrypt a symmetric key, wrap the payload under it).

Source

fn wrap( accessor: &Accessor<T, Self>, self_: Resource<EncryptionKey>, label: Option<Vec<u8>>, input: Resource<WrapInput>, ) -> impl Future<Output = Result<Result<Vec<u8>, Error>>> + Send

Wrap key material serialized as a wrap-input (see the wrapping interface): the material transits neither caller. The serialized form must fit the key’s bound — symmetric-key JWKs do, private-key serializations generally do not — else error.extension "message-too-long", as on encrypt.

Source

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

The public key material, in the minting interface’s documented public format; algorithms without a raw public form (the RSA family) fail error.unsupported. No extractability gate — public keys are unconditionally exportable — but still fallible: a provider may hold a handle it can use but not read (see README.md, “Extractability”).

Source

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

The public key as an X.509 SubjectPublicKeyInfo (DER), with the same fallibility as export-key-raw.

Source

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

The public key as a JWK. See mac-key.export-key-jwk for the package-wide JWK contract; the same fallibility applies.

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§