4 /*****************************************************************************\
6 * Name : SSL initialization helper *
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 2005-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 #include <basis/byte_array.h>
19 #include <mathematics/chaos.h>
21 #include <openssl/opensslv.h>
25 //! provides some initialization for the RSA and blowfish crypto.
27 This class does the SSL initialization needed before any functions can
28 be used. It also sets up the random seed for SSL. NOTE: you should never
29 need to use this class directly; just use the accessor function at the
30 very bottom and it will be managed globally for the entire program.
33 // we define NEWER_OPENSSL for those places where we're using more recent versions.
34 // this forces the code to choose newer methods over deprecated ones.
35 #if OPENSSL_VERSION_NUMBER > 0x10100000L
39 class ssl_init : public virtual basis::nameable
45 DEFINE_CLASS_NAME("ssl_init");
47 basis::byte_array random_bytes(int length) const;
48 //!< can be used to generate a random array of "length" bytes.
50 const mathematics::chaos &randomizer() const;
51 //!< provides a random number generator for any encryption routines.
54 mathematics::chaos c_rando; //!< used for generating random numbers.
57 extern const ssl_init &static_ssl_initializer();
58 //!< the main method for accessing the SSL initialization support.