aboutsummaryrefslogtreecommitdiffstats
path: root/wrappers/swig/base.cpp
blob: 448b3d48e5b0f9901a875f6e23ca45973fcefbed (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 Jack Lloyd                       *
*************************************************/

#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)
   {
   }