pub(crate) trait KeyEncryptableWithContentType<Key: CryptoKey, Output> {
// Required method
fn encrypt_with_key(
self,
key: &Key,
content_format: ContentFormat,
) -> Result<Output, CryptoError>;
}Expand description
An encryption operation that takes the input value and encrypts it into the output value using a key reference, with an externally provided content type.
In contrast to KeyEncryptable, this trait allows the caller to specify the content format.
Because of this, it is not exposed outside of the crate, because outside callers should
not make a choice about the content format. Where possible, the content format is
ensured at compile time by the type system, not at runtime by the caller passing
in a parameter.