Hello,

I am working on a GUI programme for crypto++. When selecting block ciphers 
dynamically (from GUI), there is a problem to choose the cipher dynamically 
in code.

Here is an example:
let's do AES-CFB-Encryption
CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption obj;

However, if I want to switch to Twofish-OFB-Decryption
CryptoPP::OFB_Mode<CryptoPP::Twofish>::Decryption obj;
I have to change 3 spots in this line. Unfortunately, I cannot put 
CryptoPP::AES in a variable. Is there a possibility to choose the algorithm 
like
CryptoPP::A<B>::C obj; with A=CBC_Mode, B=AES, C=Decryption
Or a string-based approach like Cipher("AES-CBC-Decryption")

Currently, I have a if-else tree with 6 algorithms, 5 modes, 
Encrypt/Decrypt, therefore, 6x5x2=60 branches, which is annoying. Is there 
a better solution?

PS.: I posted the same issue on stack overflow 
https://stackoverflow.com/questions/77758291/crypto-variable-dependend-blockcipher-algorithm-and-mode

greetings from Austria 

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/ae7fcc45-1e8b-46e7-8f58-4317b4c68795n%40googlegroups.com.

Reply via email to