15#include <botan/exceptn.h>
16#include <botan/version.h>
26CryptoLink::~CryptoLink() {
32 RNGImpl() : rng(new BotanRandomNumberGenerator()) {
39 std::vector<uint8_t>
random(
size_t len) {
40 std::vector<uint8_t>
data;
44 rng->randomize(&
data[0], len);
45 }
catch (
const Botan::Exception& ex) {
47 "Botan error: " << ex.
what());
53 boost::shared_ptr<Botan::RandomNumberGenerator> rng;
60 c.impl_.reset(
new CryptoLinkImpl());
61 }
catch (
const Botan::Exception& ex) {
62 isc_throw(InitializationError,
"Botan error: " << ex.what());
67 c.rng_.reset(
new RNGImpl());
68 }
catch (
const Botan::Exception& ex) {
69 isc_throw(InitializationError,
"Botan error: " << ex.what());
76 return (Botan::version_string());
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Singleton entry point and factory class.
static std::string getVersion()
Get version string.
This exception is raised when a general error that was not specifically caught is thrown by the under...
RNG()
Constructor from a Random Number Generator.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::vector< uint8_t > random(size_t len)
Generate random value.
Defines the logger used by the top-level component of kea-lfc.