diff options
author | lloyd <[email protected]> | 2008-09-29 20:17:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-29 20:17:08 +0000 |
commit | 7c0319368d1948d54db514e5f72c589a397e2909 (patch) | |
tree | 2d52b6dd8715a6ea0fc21b3a66673fb38a8d4ebb /wrappers/swig/base.h | |
parent | 0f2dfff90fe3882a85308d66a05803178a452023 (diff) |
Remove the misc dir:
Moved XS, Boost Python, and SWIG wrappers to new toplevel directory 'wrappers'
Moved NIST X.509 test suite into checks directory
Move the build information used by configure.pl to src/build-data
Move scripts directory to doc (for lack of a better spot)
Diffstat (limited to 'wrappers/swig/base.h')
-rw-r--r-- | wrappers/swig/base.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/wrappers/swig/base.h b/wrappers/swig/base.h new file mode 100644 index 000000000..c3fd8426e --- /dev/null +++ b/wrappers/swig/base.h @@ -0,0 +1,102 @@ +/************************************************* +* SWIG Interface for Botan * +* (C) 1999-2003 The Botan Project * +*************************************************/ + +#ifndef BOTAN_WRAP_BASE_H__ +#define BOTAN_WRAP_BASE_H__ + +#include <botan/pipe.h> + +#if !defined(SWIG) + #define OUTPUT + #define INOUT +#endif + +/************************************************* +* Typedefs * +*************************************************/ +typedef unsigned char byte; +typedef unsigned int u32bit; + +/************************************************* +* Library Initalization/Shutdown Object * +*************************************************/ +class LibraryInitializer + { + public: + LibraryInitializer(const char*); + ~LibraryInitializer(); + }; + +/************************************************* +* Symmetric Key Object * +*************************************************/ +class SymmetricKey + { + public: + std::string as_string() const { return key->as_string(); } + u32bit length() const { return key->length(); } + SymmetricKey(u32bit = 0); + SymmetricKey(const std::string&); + ~SymmetricKey(); + private: + Botan::SymmetricKey* key; + }; + +/************************************************* +* Initialization Vector Object * +*************************************************/ +class InitializationVector + { + public: + std::string as_string() const { return iv.as_string(); } + u32bit length() const { return iv.length(); } + InitializationVector(u32bit n = 0) { iv.change(n); } + InitializationVector(const std::string&); + private: + Botan::InitializationVector iv; + }; + +/************************************************* +* Filter Object * +*************************************************/ +class Filter + { + public: + Filter(const char*); + //Filter(const char*, const SymmetricKey&); + //Filter(const char*, const SymmetricKey&, const InitializationVector&); + ~Filter(); + private: + friend class Pipe; + Botan::Filter* filter; + bool pipe_owns; + }; + +/************************************************* +* Pipe Object * +*************************************************/ +class Pipe + { + public: + static const u32bit DEFAULT_MESSAGE = 0xFFFFFFFF; + + void write_file(const char*); + void write_string(const char*); + + u32bit read(byte*, u32bit, u32bit = DEFAULT_MESSAGE); + std::string read_all_as_string(u32bit = DEFAULT_MESSAGE); + + u32bit remaining(u32bit = DEFAULT_MESSAGE); + + void start_msg(); + void end_msg(); + + Pipe(Filter* = 0, Filter* = 0, Filter* = 0, Filter* = 0); + ~Pipe(); + private: + Botan::Pipe* pipe; + }; + +#endif |