pub fn wrap_key<T: Serialize + DeserializeOwned>(
        self,
        payload: &[u8],
        key: &jwk::JWK<T>,
        options: &EncryptionOptions,
    ) -> Result<EncryptionResult, Error> {
        use self::KeyManagementAlgorithm::*;

        match self {
            A128GCMKW | A192GCMKW | A256GCMKW => self.aes_gcm_encrypt(payload, key, options),
            DirectSymmetricKey => match *options {
                EncryptionOptions::None => Ok(Default::default()),
                ref other => Err(unexpected_encryption_options_error!(
                    EncryptionOptions::None,
                    other
                )),
            },
            _ => Err(Error::UnsupportedOperation),
        }
    }
/// Encrypt or wrap a Content Encryption Key with the provided algorithm
Encrypt or wrap a Content Encryption Key with the provided algorithm
Encrypt or wrap a Content Encryption Key with the provided algorithm
pub fn wrap_key<T: Serialize + DeserializeOwned>(
        self,
        payload: &[u8],
        key: &jwk::JWK<T>,
        options: &EncryptionOptions,
    ) -> Result<EncryptionResult, Error> {
        use self::KeyManagementAlgorithm::*;
        match self {
            A128GCMKW | A192GCMKW | A256GCMKW => self.aes_gcm_encrypt(payload, key, options),
            DirectSymmetricKey => match *options {
                EncryptionOptions::None => Ok(Default::default()),
                ref other => Err(unexpected_encryption_options_error!(
                    EncryptionOptions::None,
                    other
                )),
            },
            _ => Err(Error::UnsupportedOperation),
        }
    }
pub fn wrap_key < T : Serialize + DeserializeOwned > ( self , payload : & [ u8 ] , key : & jwk :: JWK < T > , options : & EncryptionOptions , ) -> Result < EncryptionResult , Error > { use self :: KeyManagementAlgorithm :: * ; match self { A128GCMKW | A192GCMKW | A256GCMKW => self . aes_gcm_encrypt ( payload , key , options ) , DirectSymmetricKey => match * options { EncryptionOptions :: None => Ok ( Default :: default ( ) ) , ref other => Err ( unexpected_encryption_options_error ! ( EncryptionOptions None other ) ) , } , _ => Err ( Error :: UnsupportedOperation ) , } }
Encrypt or wrap a Content Encryption Key with the provided algorithm
Encrypt or wrap a Content Encryption Key with the provided algorithm
self
payload
&[u8]
key
&jwk::JWK<T>
options
&EncryptionOptions
self
payload
&[u8]
key
&jwk::JWK<T>
options
&EncryptionOptions