monotone

monotone Mtn Source Tree

Root/botan/symkey.h

1/*************************************************
2* OctetString Header File *
3* (C) 1999-2006 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_SYMKEY_H__
7#define BOTAN_SYMKEY_H__
8
9#include <botan/secmem.h>
10#include <string>
11
12namespace Botan {
13
14/*************************************************
15* Octet String *
16*************************************************/
17class OctetString
18 {
19 public:
20 u32bit length() const { return bits.size(); }
21 SecureVector<byte> bits_of() const { return bits; }
22
23 const byte* begin() const { return bits.begin(); }
24 const byte* end() const { return bits.end(); }
25
26 std::string as_string() const;
27
28 OctetString& operator^=(const OctetString&);
29
30 void set_odd_parity();
31
32 void change(u32bit);
33 void change(const std::string&);
34 void change(const byte[], u32bit);
35 void change(const MemoryRegion<byte>& in) { bits = in; }
36
37 OctetString(u32bit len) { change(len); }
38 OctetString(const std::string& str = "") { change(str); }
39 OctetString(const byte in[], u32bit len) { change(in, len); }
40 OctetString(const MemoryRegion<byte>& in) { change(in); }
41 private:
42 SecureVector<byte> bits;
43 };
44
45/*************************************************
46* Operations on Octet Strings *
47*************************************************/
48bool operator==(const OctetString&, const OctetString&);
49bool operator!=(const OctetString&, const OctetString&);
50OctetString operator+(const OctetString&, const OctetString&);
51OctetString operator^(const OctetString&, const OctetString&);
52
53/*************************************************
54* Alternate Names *
55*************************************************/
56typedef OctetString SymmetricKey;
57typedef OctetString InitializationVector;
58
59}
60
61#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status