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// forward.
24struct ossl_provider_st;
25
26namespace crypto {
27
29
36// we define NEWER_OPENSSL for those places where we're using more recent versions.
37// this forces the code to choose newer methods over deprecated ones.
38#if OPENSSL_VERSION_NUMBER > 0x10100000L
39 #define NEWER_OPENSSL
40#endif
41
42class ssl_init : public virtual basis::nameable
43{
44public:
45 ssl_init();
46 ~ssl_init();
47
48 DEFINE_CLASS_NAME("ssl_init");
49
50 basis::byte_array random_bytes(int length) const;
52
53 const mathematics::chaos &randomizer() const;
55
56private:
57 mathematics::chaos c_rando;
58 // we hang onto our providers so we can clean them up on exit.
59 ossl_provider_st *c_default_provider;
60 ossl_provider_st *c_legacy_provider;
61};
62
65
66} //namespace.
67
68#endif
69
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:43
const mathematics::chaos & randomizer() const
provides a random number generator for any encryption routines.
Definition ssl_init.cpp:94
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:96
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.