pub fn encrypt_with_iv_regular(
        self,
        key: &[u8],
        iv_vec: &[u8],
        plaintext: &mut [u8],
    ) -> Result<()> {
        // TODO: actual cfb mode used in pgp
        match self {
            SymmetricKeyAlgorithm::Plaintext => {}
            SymmetricKeyAlgorithm::IDEA => unimplemented!("IDEA encrypt"),
            SymmetricKeyAlgorithm::TripleDES => {
                encrypt_regular!(TdesEde3, key, iv_vec, plaintext, bs);
            }
            SymmetricKeyAlgorithm::CAST5 => encrypt_regular!(Cast5, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::Blowfish => {
                encrypt_regular!(Blowfish, key, iv_vec, plaintext, bs)
            }
            SymmetricKeyAlgorithm::AES128 => encrypt_regular!(Aes128, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::AES192 => encrypt_regular!(Aes192, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::AES256 => encrypt_regular!(Aes256, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::Twofish => encrypt_regular!(Twofish, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::Camellia128 => {
                unimplemented_err!("Camellia 128 not yet available")
            }
            SymmetricKeyAlgorithm::Camellia192 => {
                unimplemented_err!("Camellia 192 not yet available")
            }
            SymmetricKeyAlgorithm::Camellia256 => {
                unimplemented_err!("Camellia 256 not yet available")
            }
            SymmetricKeyAlgorithm::Private10 => {
                unimplemented_err!("Private10 should not be used, and only exist for compatability")
            }
        }
        Ok(())
    }
/// Encrypt the data using CFB mode, without padding. Overwrites the input.
Encrypt the data using CFB mode, without padding. Overwrites the input.
Encrypt the data using CFB mode without padding . Overwrites the input .
pub fn encrypt_with_iv_regular(
        self,
        key: &[u8],
        iv_vec: &[u8],
        plaintext: &mut [u8],
    ) -> Result<()> {
        // TODO: actual cfb mode used in pgp
        match self {
            SymmetricKeyAlgorithm::Plaintext => {}
            SymmetricKeyAlgorithm::IDEA => unimplemented!("IDEA encrypt"),
            SymmetricKeyAlgorithm::TripleDES => {
                encrypt_regular!(TdesEde3, key, iv_vec, plaintext, bs);
            }
            SymmetricKeyAlgorithm::CAST5 => encrypt_regular!(Cast5, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::Blowfish => {
                encrypt_regular!(Blowfish, key, iv_vec, plaintext, bs)
            }
            SymmetricKeyAlgorithm::AES128 => encrypt_regular!(Aes128, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::AES192 => encrypt_regular!(Aes192, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::AES256 => encrypt_regular!(Aes256, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::Twofish => encrypt_regular!(Twofish, key, iv_vec, plaintext, bs),
            SymmetricKeyAlgorithm::Camellia128 => {
                unimplemented_err!("Camellia 128 not yet available")
            }
            SymmetricKeyAlgorithm::Camellia192 => {
                unimplemented_err!("Camellia 192 not yet available")
            }
            SymmetricKeyAlgorithm::Camellia256 => {
                unimplemented_err!("Camellia 256 not yet available")
            }
            SymmetricKeyAlgorithm::Private10 => {
                unimplemented_err!("Private10 should not be used, and only exist for compatability")
            }
        }
        Ok(())
    }
pub fn encrypt_with_iv_regular ( self , key : & [ u8 ] , iv_vec : & [ u8 ] , plaintext : & mut [ u8 ] , ) -> Result < ( ) > { // TODO: actual cfb mode used in pgp match self { SymmetricKeyAlgorithm :: Plaintext => { } SymmetricKeyAlgorithm :: IDEA => unimplemented ! ( " " ) , SymmetricKeyAlgorithm :: TripleDES => { encrypt_regular ! ( TdesEde3 key iv_vec plaintext bs ) ; } SymmetricKeyAlgorithm :: CAST5 => encrypt_regular ! ( Cast5 key iv_vec plaintext bs ) , SymmetricKeyAlgorithm :: Blowfish => { encrypt_regular ! ( Blowfish key iv_vec plaintext bs ) } SymmetricKeyAlgorithm :: AES128 => encrypt_regular ! ( Aes128 key iv_vec plaintext bs ) , SymmetricKeyAlgorithm :: AES192 => encrypt_regular ! ( Aes192 key iv_vec plaintext bs ) , SymmetricKeyAlgorithm :: AES256 => encrypt_regular ! ( Aes256 key iv_vec plaintext bs ) , SymmetricKeyAlgorithm :: Twofish => encrypt_regular ! ( Twofish key iv_vec plaintext bs ) , SymmetricKeyAlgorithm :: Camellia128 => { unimplemented_err ! ( " " ) } SymmetricKeyAlgorithm :: Camellia192 => { unimplemented_err ! ( " " ) } SymmetricKeyAlgorithm :: Camellia256 => { unimplemented_err ! ( " " ) } SymmetricKeyAlgorithm :: Private10 => { unimplemented_err ! ( " " ) } } Ok ( ( ) ) }
Encrypt the data using CFB mode, without padding.
Encrypt the data using CFB mode without padding .
self
key
&[u8]
iv_vec
&[u8]
plaintext
&mut [u8]
self
key
&[u8]
iv_vec
&[u8]
plaintext
&mut [u8]