#include <blowfish_crypto.h>
Inheritance diagram for blowfish_crypto:


Public Member Functions | |
| blowfish_crypto (int key_size) | |
| this will create a new random key of the "key_size", in bits. | |
| blowfish_crypto (const byte_array &key, int key_size) | |
| uses a pre-existing "key". | |
| blowfish_crypto (const blowfish_crypto &to_copy) | |
| copy constructor. | |
| virtual | ~blowfish_crypto () |
| blowfish_crypto & | operator= (const blowfish_crypto &to_copy) |
| IMPLEMENT_CLASS_NAME ("blowfish_crypto") | |
| int | key_size () const |
| const byte_array & | get_key () const |
| returns our current key. | |
| bool | set_key (const byte_array &new_key, int key_size) |
| sets the encryption key to "new_key". | |
| bool | encrypt (const byte_array &source, byte_array &target) const |
| encrypts the "source" array into the "target" array. | |
| bool | decrypt (const byte_array &source, byte_array &target) const |
| decrypts the "target" array from the encrypted "source" array. | |
Static Public Member Functions | |
| static int | minimum_key_size () |
| returns the minimum key size (in bits) supported here. | |
| static int | maximum_key_size () |
| returns the maximum key size (in bits) supported here. | |
| static void | generate_key (int size, byte_array &new_key) |
| creates a "new_key" of the "size" (in bits) specified. | |
| static const byte_array & | init_vector () |
| returns the initialization vector that is used by this class. | |
Definition at line 24 of file blowfish_crypto.h.
| blowfish_crypto::blowfish_crypto | ( | int | key_size | ) |
this will create a new random key of the "key_size", in bits.
the valid sizes are from 64 bits to 448 bits (we are forcing a higher minimum than the published algorithm because we have found smaller keys to be unreliable during decryption. keys of 168 bits and larger should be very secure. it is said that if a billion computers each tried a billion keys a second, then a 168 bit key would take 10 * 10^24 years to break (using brute force). this is essentially unbreakable since the age of the universe is only 10 * 10^9 years so far.
Definition at line 73 of file blowfish_crypto.cpp.
References DISCUSS_KEY_SIZE, FUNCDEF, generate_key(), maximum_key_size(), minimum_key_size(), and static_ssl_initializer().
| blowfish_crypto::blowfish_crypto | ( | const byte_array & | key, | |
| int | key_size | |||
| ) |
uses a pre-existing "key".
Definition at line 87 of file blowfish_crypto.cpp.
References DISCUSS_KEY_SIZE, DISCUSS_PROVIDED_KEY, FUNCDEF, and static_ssl_initializer().
| blowfish_crypto::blowfish_crypto | ( | const blowfish_crypto & | to_copy | ) |
copy constructor.
Definition at line 99 of file blowfish_crypto.cpp.
References static_ssl_initializer().
| blowfish_crypto::~blowfish_crypto | ( | ) | [virtual] |
| blowfish_crypto & blowfish_crypto::operator= | ( | const blowfish_crypto & | to_copy | ) |
| blowfish_crypto::IMPLEMENT_CLASS_NAME | ( | "blowfish_crypto" | ) |
| int blowfish_crypto::key_size | ( | ) | const |
Definition at line 110 of file blowfish_crypto.cpp.
| int blowfish_crypto::minimum_key_size | ( | ) | [static] |
returns the minimum key size (in bits) supported here.
Definition at line 114 of file blowfish_crypto.cpp.
Referenced by blowfish_crypto(), encryption_tentacle::consume(), generate_key(), and set_key().
| int blowfish_crypto::maximum_key_size | ( | ) | [static] |
returns the maximum key size (in bits) supported here.
Definition at line 116 of file blowfish_crypto.cpp.
Referenced by blowfish_crypto(), generate_key(), and set_key().
| const byte_array & blowfish_crypto::get_key | ( | ) | const |
returns our current key.
Definition at line 112 of file blowfish_crypto.cpp.
Referenced by cromp_client::login(), and encryption_infoton::prepare_blowfish_key().
| bool blowfish_crypto::set_key | ( | const byte_array & | new_key, | |
| int | key_size | |||
| ) |
sets the encryption key to "new_key".
Definition at line 126 of file blowfish_crypto.cpp.
References BITS_PER_BYTE, DISCUSS_KEY_SIZE, DISCUSS_PROVIDED_KEY, FUNCDEF, array< contents >::length(), maximum_key_size(), and minimum_key_size().
Referenced by encryption_infoton::extract_response(), and cromp_client::login().
| void blowfish_crypto::generate_key | ( | int | size, | |
| byte_array & | new_key | |||
| ) | [static] |
creates a "new_key" of the "size" (in bits) specified.
Definition at line 140 of file blowfish_crypto.cpp.
References BITS_PER_BYTE, DISCUSS_KEY_SIZE, FUNCDEF, maximum_key_size(), minimum_key_size(), array< contents >::reset(), and static_ssl_initializer().
Referenced by blowfish_crypto().
| bool blowfish_crypto::encrypt | ( | const byte_array & | source, | |
| byte_array & | target | |||
| ) | const |
encrypts the "source" array into the "target" array.
Definition at line 170 of file blowfish_crypto.cpp.
References object_base::class_name(), continuable_error, FUDGE, FUNCDEF, init_vector(), array< contents >::length(), NIL, array< contents >::observe(), and array< contents >::reset().
| bool blowfish_crypto::decrypt | ( | const byte_array & | source, | |
| byte_array & | target | |||
| ) | const |
decrypts the "target" array from the encrypted "source" array.
Definition at line 224 of file blowfish_crypto.cpp.
References object_base::class_name(), continuable_error, FUDGE, FUNCDEF, init_vector(), array< contents >::length(), NIL, array< contents >::observe(), and array< contents >::reset().
Referenced by encryption_tentacle::consume().
| const byte_array & blowfish_crypto::init_vector | ( | ) | [static] |
returns the initialization vector that is used by this class.
decryption of chunks that were encrypted by this class will require the same init vector as this function returns. this is mainly provided for third-party applications that want to be able to decrypt interoperably with this class. if you are creating such an application but for some reason cannot run this class in order to invoke this method, the vector is created by the algorithm in this class's implementation file (currently named blowfish_crypto.cpp).
Definition at line 157 of file blowfish_crypto.cpp.
1.5.1