crypto::blowfish_crypto Class Reference

Provides BlowFish encryption on byte_arrays using the OpenSSL package. More...

#include <blowfish_crypto.h>

Inheritance diagram for crypto::blowfish_crypto:
Inheritance graph
[legend]
Collaboration diagram for crypto::blowfish_crypto:
Collaboration graph
[legend]

List of all members.

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_cryptooperator= (const blowfish_crypto &to_copy)
 DEFINE_CLASS_NAME ("blowfish_crypto")
int key_size () const
const basis::byte_arrayget_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_arrayinit_vector ()
 returns the initialization vector that is used by this class.

Detailed Description

Provides BlowFish encryption on byte_arrays using the OpenSSL package.

Definition at line 25 of file blowfish_crypto.h.


Constructor & Destructor Documentation

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().


Member Function Documentation

bool crypto::blowfish_crypto::decrypt ( const basis::byte_array source,
basis::byte_array target 
) const
crypto::blowfish_crypto::DEFINE_CLASS_NAME ( "blowfish_crypto"   ) 
bool crypto::blowfish_crypto::encrypt ( const basis::byte_array source,
basis::byte_array target 
) const
void crypto::blowfish_crypto::generate_key ( int  size,
basis::byte_array new_key 
) [static]
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.

Referenced by decrypt(), and encrypt().

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 
)

The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:25:30 2012 for hoople2 project by  doxygen 1.6.3