feisty meow concerns codebase  2.140
ssl_init.h
Go to the documentation of this file.
1 #ifndef SSL_INIT_CLASS
2 #define SSL_INIT_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : SSL initialization helper *
7 * Author : Chris Koeritz *
8 * *
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 \*****************************************************************************/
17 
18 #include <basis/byte_array.h>
19 #include <mathematics/chaos.h>
20 
21 #include <openssl/opensslv.h>
22 
23 namespace crypto {
24 
26 
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
36  #define NEWER_OPENSSL
37 #endif
38 
39 class ssl_init : public virtual basis::nameable
40 {
41 public:
42  ssl_init();
43  ~ssl_init();
44 
45  DEFINE_CLASS_NAME("ssl_init");
46 
47  basis::byte_array random_bytes(int length) const;
49 
50  const mathematics::chaos &randomizer() const;
52 
53 private:
54  mathematics::chaos c_rando;
55 };
56 
59 
60 } //namespace.
61 
62 #endif
63 
A very common template for a dynamic array of bytes.
Definition: byte_array.h:36
Root object for any class that knows its own name.
Definition: contracts.h:123
provides some initialization for the RSA and blowfish crypto.
Definition: ssl_init.h:40
const mathematics::chaos & randomizer() const
provides a random number generator for any encryption routines.
Definition: ssl_init.cpp:85
DEFINE_CLASS_NAME("ssl_init")
basis::byte_array random_bytes(int length) const
can be used to generate a random array of "length" bytes.
Definition: ssl_init.cpp:87
a platform-independent way to acquire random numbers in a specific range.
Definition: chaos.h:51
const ssl_init & static_ssl_initializer()
the main method for accessing the SSL initialization support.