Greets,
In Crypto++ 4.2, I did something like this to generate *Encryption/Decryption
objects on the fly:
BlockTransformation* bt = getEncryptionObject();
The getEncryptionObject() method being implemented in some class thusly:
BlockTransformation* MyAESClass::getEncryptionObject()
{
return new AESEncryption((byte*) itsKey, itsKeylength);
}
Once I had bt set to a BlockTransformation (in this case, an AESEncryption
object), I would hand it off to another method that would implement
CBCPaddedEncryptor or CBC_CTS_Encryptor or some ECB implementation.
With Crypto++ 5.0, the hierarchy for the classes has changed enough that using
pointers to BlockTransformations no longer does what I'm expecting it to. (It
would appear that AESEncryption doesn't inherit from BlockTransformation at
all...)
I tried using pointers to BlockCipher, BlockTransformation and everything else
I can think of to replicate the expected behaviour from 4.2 in 5.0 but to no
avail. I ended up getting some lovely segfaults and aborts, but that's about
it.
What would be the easiest way to do this sort of thing with Crypto++ 5.0? What
I'm basically looking for is a way to abstract all of the ciphers to the
point where I can just say getEncryptionObject() on an object and depending
on what I've instantiated, I can expect to receive a pointer to an
AESEncryption object or a TwofishEncryption object or whatever?
For those who are interested, a more detailed look at what I'm doing now can
be found at http://www.tutorbuddy.com/software/ under cryptopp-php. (I'm the
author of a cryptography extension for the PHP language based on Crypto++,
hence the name cryptopp-php.)
Any advice concerning the jump from 4.2 to 5.0 is appreciated. Thx.
J