1 #ifndef BLOWFISH_CRYPTO_CLASS
2 #define BLOWFISH_CRYPTO_CLASS
A very common template for a dynamic array of bytes.
Provides BlowFish encryption on byte_arrays using the OpenSSL package.
blowfish_crypto(int key_size)
this will create a new random key of the "key_size", in bits.
static int minimum_key_size()
returns the minimum key size (in bits) supported here.
bool decrypt(const basis::byte_array &source, basis::byte_array &target) const
decrypts the "target" array from the encrypted "source" array.
DEFINE_CLASS_NAME("blowfish_crypto")
static const basis::byte_array & init_vector()
returns the initialization vector that is used by this class.
bool encrypt(const basis::byte_array &source, basis::byte_array &target) const
encrypts the "source" array into the "target" array.
static int maximum_key_size()
returns the maximum key size (in bits) supported here.
blowfish_crypto & operator=(const blowfish_crypto &to_copy)
static void generate_key(int size, basis::byte_array &new_key)
creates a "new_key" of the "size" (in bits) specified.
virtual ~blowfish_crypto()
bool set_key(const basis::byte_array &new_key, int key_size)
sets the encryption key to "new_key".
const basis::byte_array & get_key() const
returns our current key.