Hello All!
 
I have design quesion about using cipher modes and block ciphers.
 
I need to enumerate cipher modes and block ciphers. E.g. Alice encrypts
 message, she uses CFB algoritghm and AES cipher. I want to save
some CFB id and AES id and append it to message. Then B wants
to decrypt message. I'm about to use something like this:
 
switch(mode) {
  case CBC: {
    case DES: {
       CFB_Mode<DES>::Decryption cfbE(key, DES::DEFAULT_KEYLENGTH, iv);
       ...
    }
    case AES: {
       CFB_Mode<AES>::Decryption cfbE(key, AES::DEFAULT_KEYLENGTH, iv);
       ...
    }
    ...
  }
  case CFB: {
    case DES: {
       CFB_Mode<DES>::Decryption cfbE(key, DES::DEFAULT_KEYLENGTH, iv);
       ...
    }
    case AES: {
       CFB_Mode<AES>::Decryption cfbE(key, AES::DEFAULT_KEYLENGTH, iv);
       ...
    }
    ...
  }
  ...
}
 
I feel there is some way to avoid this terrible swithes, but structure of CryptoPP
 is bit complicated for me, and I can not understand how to solve my task without
such switched.
 
Can you hint how to solve my task with CryptoPP library, please?
 
Best Regards,
Voronkov Konstantin

Reply via email to