Provides BlowFish encryption on byte_arrays using the OpenSSL package. More...
#include <blowfish_crypto.h>


Public Member Functions | |
| blowfish_crypto (int key_size) | |
| this will create a new random key of the "key_size", in bits. | |
| blowfish_crypto (const basis::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) |
| DEFINE_CLASS_NAME ("blowfish_crypto") | |
| int | key_size () const |
| const basis::byte_array & | get_key () const |
| returns our current key. | |
| bool | set_key (const basis::byte_array &new_key, int key_size) |
| sets the encryption key to "new_key". | |
| bool | encrypt (const basis::byte_array &source, basis::byte_array &target) const |
| encrypts the "source" array into the "target" array. | |
| bool | decrypt (const basis::byte_array &source, basis::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, basis::byte_array &new_key) |
| creates a "new_key" of the "size" (in bits) specified. | |
| static const basis::byte_array & | init_vector () |
| returns the initialization vector that is used by this class. | |
Provides BlowFish encryption on byte_arrays using the OpenSSL package.
Definition at line 25 of file blowfish_crypto.h.
| crypto::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 77 of file blowfish_crypto.cpp.
References DISCUSS_KEY_SIZE, generate_key(), maximum_key_size(), minimum_key_size(), and crypto::static_ssl_initializer().
| crypto::blowfish_crypto::blowfish_crypto | ( | const basis::byte_array & | key, | |
| int | key_size | |||
| ) |
uses a pre-existing "key".
Definition at line 91 of file blowfish_crypto.cpp.
References DISCUSS_KEY_SIZE, DISCUSS_PROVIDED_KEY, and crypto::static_ssl_initializer().
| crypto::blowfish_crypto::blowfish_crypto | ( | const blowfish_crypto & | to_copy | ) |
copy constructor.
Definition at line 103 of file blowfish_crypto.cpp.
References crypto::static_ssl_initializer().
| crypto::blowfish_crypto::~blowfish_crypto | ( | ) | [virtual] |
Definition at line 109 of file blowfish_crypto.cpp.
References basis::WHACK().
| bool crypto::blowfish_crypto::decrypt | ( | const basis::byte_array & | source, | |
| basis::byte_array & | target | |||
| ) | const |
decrypts the "target" array from the encrypted "source" array.
Definition at line 228 of file blowfish_crypto.cpp.
References continuable_error, crypto::FUDGE, FUNCDEF, init_vector(), basis::array< contents >::length(), NIL, basis::array< contents >::observe(), and basis::array< contents >::reset().
Referenced by octopi::encryption_tentacle::consume().
| crypto::blowfish_crypto::DEFINE_CLASS_NAME | ( | "blowfish_crypto" | ) |
| bool crypto::blowfish_crypto::encrypt | ( | const basis::byte_array & | source, | |
| basis::byte_array & | target | |||
| ) | const |
encrypts the "source" array into the "target" array.
Definition at line 174 of file blowfish_crypto.cpp.
References continuable_error, crypto::FUDGE, FUNCDEF, init_vector(), basis::array< contents >::length(), NIL, basis::array< contents >::observe(), and basis::array< contents >::reset().
| void crypto::blowfish_crypto::generate_key | ( | int | size, | |
| basis::byte_array & | new_key | |||
| ) | [static] |
creates a "new_key" of the "size" (in bits) specified.
Definition at line 144 of file blowfish_crypto.cpp.
References BITS_PER_BYTE, DISCUSS_KEY_SIZE, mathematics::chaos::inclusive(), maximum_key_size(), minimum_key_size(), crypto::ssl_init::randomizer(), basis::array< contents >::reset(), and crypto::static_ssl_initializer().
Referenced by blowfish_crypto().
| const byte_array & crypto::blowfish_crypto::get_key | ( | ) | const |
returns our current key.
Definition at line 116 of file blowfish_crypto.cpp.
Referenced by cromp::cromp_client::login(), and octopi::encryption_infoton::prepare_blowfish_key().
| const byte_array & crypto::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 161 of file blowfish_crypto.cpp.
| int crypto::blowfish_crypto::key_size | ( | ) | const |
Definition at line 114 of file blowfish_crypto.cpp.
| int crypto::blowfish_crypto::maximum_key_size | ( | ) | [static] |
returns the maximum key size (in bits) supported here.
Definition at line 120 of file blowfish_crypto.cpp.
Referenced by blowfish_crypto(), generate_key(), and set_key().
| int crypto::blowfish_crypto::minimum_key_size | ( | ) | [static] |
returns the minimum key size (in bits) supported here.
Definition at line 118 of file blowfish_crypto.cpp.
Referenced by blowfish_crypto(), generate_key(), and set_key().
| blowfish_crypto & crypto::blowfish_crypto::operator= | ( | const blowfish_crypto & | to_copy | ) |
Definition at line 122 of file blowfish_crypto.cpp.
| bool crypto::blowfish_crypto::set_key | ( | const basis::byte_array & | new_key, | |
| int | key_size | |||
| ) |
sets the encryption key to "new_key".
Definition at line 130 of file blowfish_crypto.cpp.
References BITS_PER_BYTE, DISCUSS_KEY_SIZE, DISCUSS_PROVIDED_KEY, basis::array< contents >::length(), maximum_key_size(), and minimum_key_size().
Referenced by octopi::encryption_infoton::extract_response(), and cromp::cromp_client::login().
1.6.3