aboutsummaryrefslogtreecommitdiffstats
path: root/misc/swig/base.cpp
blob: 2550b915b062ed37d9ca7f4d05dc13fd6938e01d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*************************************************
* SWIG Interface for basic Botan interface       *
* (C) 1999-2003 The Botan Project                *
*************************************************/

#include "base.h"
#include <botan/init.h>

#include <stdio.h>

/*************************************************
* Initialize the library                         *
*************************************************/
LibraryInitializer::LibraryInitializer(const char* args)
   {
   Botan::Init::initialize(args);
   }

/*************************************************
* Shut down the library                          *
*************************************************/
LibraryInitializer::~LibraryInitializer()
   {
   Botan::Init::deinitialize();
   }

/*************************************************
* Create a SymmetricKey                          *
*************************************************/
SymmetricKey::SymmetricKey(const std::string& str)
   {
   key = new Botan::SymmetricKey(str);
   printf("STR CON: %p %p\n", this, key);
   }

/*************************************************
* Create a SymmetricKey                          *
*************************************************/
SymmetricKey::SymmetricKey(u32bit n)
   {
   key = new Botan::SymmetricKey(n);
   printf("N CON: %p %p\n", this, key);
   }

/*************************************************
* Destroy a SymmetricKey                         *
*************************************************/
SymmetricKey::~SymmetricKey()
   {
   printf("DESTR: %p %p\n", this, key);
   delete key;
   key = 0;
   //printf("deleted\n");
   }

/*************************************************
* Create an InitializationVector                 *
*************************************************/
InitializationVector::InitializationVector(const std::string& str) : iv(str)
   {
   }