pub fn generate_key(self) -> Result<Vec<u8>, Error> {
        use self::ContentEncryptionAlgorithm::*;

        let length: usize = match self {
            A128GCM => 128 / 8,
            A256GCM => 256 / 8,
            _ => Err(Error::UnsupportedOperation)?,
        };

        let mut key: Vec<u8> = vec![0; length];
        rng().fill(&mut key)?;
        Ok(key)
    }
/// Convenience function to generate a new random key with the required length
Convenience function to generate a new random key with the required length
Convenience function to generate a new random key with the required length
pub fn generate_key(self) -> Result<Vec<u8>, Error> {
        use self::ContentEncryptionAlgorithm::*;
        let length: usize = match self {
            A128GCM => 128 / 8,
            A256GCM => 256 / 8,
            _ => Err(Error::UnsupportedOperation)?,
        };
        let mut key: Vec<u8> = vec![0; length];
        rng().fill(&mut key)?;
        Ok(key)
    }
pub fn generate_key ( self ) -> Result < Vec < u8 > , Error > { use self :: ContentEncryptionAlgorithm :: * ; let length : usize = match self { A128GCM => 128 / 8 , A256GCM => 256 / 8 , _ => Err ( Error :: UnsupportedOperation ) ? , } ; let mut key : Vec < u8 > = vec ! [ 0 length ] ; rng ( ) . fill ( & mut key ) ? ; Ok ( key ) }
Convenience function to generate a new random key with the required length
Convenience function to generate a new random key with the required length
self
self