aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/asn1/alg_id.cpp (renamed from src/alg_id.cpp)0
-rw-r--r--src/asn1/alg_id.h47
-rw-r--r--src/asn1/asn1_alt.cpp (renamed from src/asn1_alt.cpp)0
-rw-r--r--src/asn1/asn1_att.cpp (renamed from src/asn1_att.cpp)0
-rw-r--r--src/asn1/asn1_dn.cpp (renamed from src/asn1_dn.cpp)0
-rw-r--r--src/asn1/asn1_int.cpp (renamed from src/asn1_int.cpp)0
-rw-r--r--src/asn1/asn1_int.h106
-rw-r--r--src/asn1/asn1_ku.cpp (renamed from src/asn1_ku.cpp)0
-rw-r--r--src/asn1/asn1_obj.h158
-rw-r--r--src/asn1/asn1_oid.cpp (renamed from src/asn1_oid.cpp)0
-rw-r--r--src/asn1/asn1_oid.h50
-rw-r--r--src/asn1/asn1_str.cpp (renamed from src/asn1_str.cpp)0
-rw-r--r--src/asn1/asn1_tm.cpp (renamed from src/asn1_tm.cpp)0
-rw-r--r--src/asn1/ber_dec.cpp (renamed from src/ber_dec.cpp)0
-rw-r--r--src/asn1/ber_dec.h130
-rw-r--r--src/asn1/der_enc.cpp (renamed from src/der_enc.cpp)0
-rw-r--r--src/asn1/der_enc.h89
-rw-r--r--src/asn1/modinfo.txt23
-rw-r--r--src/codec/base64/base64.cpp (renamed from src/base64.cpp)0
-rw-r--r--src/codec/base64/base64.h60
-rw-r--r--src/codec/base64/modinfo.txt10
-rw-r--r--src/codec/bzip2/bzip2.cpp (renamed from src/compress/bzip2/bzip2.cpp)0
-rw-r--r--src/codec/bzip2/bzip2.h (renamed from src/compress/bzip2/bzip2.h)0
-rw-r--r--src/codec/bzip2/modinfo.txt (renamed from src/compress/bzip2/modinfo.txt)0
-rw-r--r--src/codec/hex/hex.cpp (renamed from src/hex.cpp)0
-rw-r--r--src/codec/hex/hex.h64
-rw-r--r--src/codec/hex/modinfo.txt10
-rw-r--r--src/codec/zlib/modinfo.txt (renamed from src/compress/zlib/modinfo.txt)0
-rw-r--r--src/codec/zlib/zlib.cpp (renamed from src/compress/zlib/zlib.cpp)0
-rw-r--r--src/codec/zlib/zlib.h (renamed from src/compress/zlib/zlib.h)0
-rw-r--r--src/pk/dl_algo/modinfo.txt15
-rw-r--r--src/pk/dl_group/modinfo.txt10
-rw-r--r--src/pk/dlies/modinfo.txt4
33 files changed, 776 insertions, 0 deletions
diff --git a/src/alg_id.cpp b/src/asn1/alg_id.cpp
index 5e5db73b3..5e5db73b3 100644
--- a/src/alg_id.cpp
+++ b/src/asn1/alg_id.cpp
diff --git a/src/asn1/alg_id.h b/src/asn1/alg_id.h
new file mode 100644
index 000000000..8187fc070
--- /dev/null
+++ b/src/asn1/alg_id.h
@@ -0,0 +1,47 @@
+/*************************************************
+* Algorithm Identifier Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_ALGORITHM_IDENTIFIER_H__
+#define BOTAN_ALGORITHM_IDENTIFIER_H__
+
+#include <botan/asn1_int.h>
+#include <botan/asn1_oid.h>
+#include <string>
+
+namespace Botan {
+
+/*************************************************
+* Algorithm Identifier *
+*************************************************/
+class BOTAN_DLL AlgorithmIdentifier : public ASN1_Object
+ {
+ public:
+ enum Encoding_Option { USE_NULL_PARAM };
+
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ AlgorithmIdentifier() {}
+ AlgorithmIdentifier(const OID&, Encoding_Option);
+ AlgorithmIdentifier(const std::string&, Encoding_Option);
+
+ AlgorithmIdentifier(const OID&, const MemoryRegion<byte>&);
+ AlgorithmIdentifier(const std::string&, const MemoryRegion<byte>&);
+
+ OID oid;
+ SecureVector<byte> parameters;
+ };
+
+/*************************************************
+* Comparison Operations *
+*************************************************/
+bool BOTAN_DLL operator==(const AlgorithmIdentifier&,
+ const AlgorithmIdentifier&);
+bool BOTAN_DLL operator!=(const AlgorithmIdentifier&,
+ const AlgorithmIdentifier&);
+
+}
+
+#endif
diff --git a/src/asn1_alt.cpp b/src/asn1/asn1_alt.cpp
index 035f918cb..035f918cb 100644
--- a/src/asn1_alt.cpp
+++ b/src/asn1/asn1_alt.cpp
diff --git a/src/asn1_att.cpp b/src/asn1/asn1_att.cpp
index 7c16ff3a5..7c16ff3a5 100644
--- a/src/asn1_att.cpp
+++ b/src/asn1/asn1_att.cpp
diff --git a/src/asn1_dn.cpp b/src/asn1/asn1_dn.cpp
index 3fd0c09b0..3fd0c09b0 100644
--- a/src/asn1_dn.cpp
+++ b/src/asn1/asn1_dn.cpp
diff --git a/src/asn1_int.cpp b/src/asn1/asn1_int.cpp
index e837dedf0..e837dedf0 100644
--- a/src/asn1_int.cpp
+++ b/src/asn1/asn1_int.cpp
diff --git a/src/asn1/asn1_int.h b/src/asn1/asn1_int.h
new file mode 100644
index 000000000..3e0562b9c
--- /dev/null
+++ b/src/asn1/asn1_int.h
@@ -0,0 +1,106 @@
+/*************************************************
+* ASN.1 Internals Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_ASN1_H__
+#define BOTAN_ASN1_H__
+
+#include <botan/secmem.h>
+#include <botan/exceptn.h>
+
+namespace Botan {
+
+/*************************************************
+* ASN.1 Type and Class Tags *
+*************************************************/
+enum ASN1_Tag {
+ UNIVERSAL = 0x00,
+ APPLICATION = 0x40,
+ CONTEXT_SPECIFIC = 0x80,
+ PRIVATE = 0xC0,
+
+ CONSTRUCTED = 0x20,
+
+ EOC = 0x00,
+ BOOLEAN = 0x01,
+ INTEGER = 0x02,
+ BIT_STRING = 0x03,
+ OCTET_STRING = 0x04,
+ NULL_TAG = 0x05,
+ OBJECT_ID = 0x06,
+ ENUMERATED = 0x0A,
+ SEQUENCE = 0x10,
+ SET = 0x11,
+
+ UTF8_STRING = 0x0C,
+ NUMERIC_STRING = 0x12,
+ PRINTABLE_STRING = 0x13,
+ T61_STRING = 0x14,
+ IA5_STRING = 0x16,
+ VISIBLE_STRING = 0x1A,
+ BMP_STRING = 0x1E,
+
+ UTC_TIME = 0x17,
+ GENERALIZED_TIME = 0x18,
+
+ NO_OBJECT = 0xFF00,
+ DIRECTORY_STRING = 0xFF01
+};
+
+/*************************************************
+* Basic ASN.1 Object Interface *
+*************************************************/
+class BOTAN_DLL ASN1_Object
+ {
+ public:
+ virtual void encode_into(class DER_Encoder&) const = 0;
+ virtual void decode_from(class BER_Decoder&) = 0;
+ virtual ~ASN1_Object() {}
+ };
+
+/*************************************************
+* BER Encoded Object *
+*************************************************/
+class BOTAN_DLL BER_Object
+ {
+ public:
+ void assert_is_a(ASN1_Tag, ASN1_Tag);
+
+ ASN1_Tag type_tag, class_tag;
+ SecureVector<byte> value;
+ };
+
+/*************************************************
+* ASN.1 Utility Functions *
+*************************************************/
+class DataSource;
+
+namespace ASN1 {
+
+SecureVector<byte> put_in_sequence(const MemoryRegion<byte>&);
+std::string to_string(const BER_Object&);
+bool maybe_BER(DataSource&);
+
+}
+
+/*************************************************
+* General BER Decoding Error Exception *
+*************************************************/
+struct BER_Decoding_Error : public Decoding_Error
+ {
+ BER_Decoding_Error(const std::string&);
+ };
+
+/*************************************************
+* Exception For Incorrect BER Taggings *
+*************************************************/
+struct BER_Bad_Tag : public BER_Decoding_Error
+ {
+ BER_Bad_Tag(const std::string&, ASN1_Tag);
+ BER_Bad_Tag(const std::string&, ASN1_Tag, ASN1_Tag);
+ };
+
+}
+
+#endif
diff --git a/src/asn1_ku.cpp b/src/asn1/asn1_ku.cpp
index 32c5944dd..32c5944dd 100644
--- a/src/asn1_ku.cpp
+++ b/src/asn1/asn1_ku.cpp
diff --git a/src/asn1/asn1_obj.h b/src/asn1/asn1_obj.h
new file mode 100644
index 000000000..67645ca08
--- /dev/null
+++ b/src/asn1/asn1_obj.h
@@ -0,0 +1,158 @@
+/*************************************************
+* Common ASN.1 Objects Header File *
+* (C) 1999-2007 Jack Lloyd *
+* 2007 Yves Jerschow *
+*************************************************/
+
+#ifndef BOTAN_ASN1_OBJ_H__
+#define BOTAN_ASN1_OBJ_H__
+
+#include <botan/asn1_int.h>
+#include <botan/asn1_oid.h>
+#include <botan/alg_id.h>
+#include <vector>
+#include <map>
+
+namespace Botan {
+
+/*************************************************
+* Attribute *
+*************************************************/
+class BOTAN_DLL Attribute : public ASN1_Object
+ {
+ public:
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ OID oid;
+ MemoryVector<byte> parameters;
+
+ Attribute() {}
+ Attribute(const OID&, const MemoryRegion<byte>&);
+ Attribute(const std::string&, const MemoryRegion<byte>&);
+ };
+
+/*************************************************
+* X.509 Time *
+*************************************************/
+class BOTAN_DLL X509_Time : public ASN1_Object
+ {
+ public:
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ std::string as_string() const;
+ std::string readable_string() const;
+ bool time_is_set() const;
+
+ s32bit cmp(const X509_Time&) const;
+
+ void set_to(const std::string&);
+ void set_to(const std::string&, ASN1_Tag);
+
+ X509_Time(u64bit);
+ X509_Time(const std::string& = "");
+ X509_Time(const std::string&, ASN1_Tag);
+ private:
+ bool passes_sanity_check() const;
+ u32bit year, month, day, hour, minute, second;
+ ASN1_Tag tag;
+ };
+
+/*************************************************
+* Simple String *
+*************************************************/
+class BOTAN_DLL ASN1_String : public ASN1_Object
+ {
+ public:
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ std::string value() const;
+ std::string iso_8859() const;
+
+ ASN1_Tag tagging() const;
+
+ ASN1_String(const std::string& = "");
+ ASN1_String(const std::string&, ASN1_Tag);
+ private:
+ std::string iso_8859_str;
+ ASN1_Tag tag;
+ };
+
+/*************************************************
+* Distinguished Name *
+*************************************************/
+class BOTAN_DLL X509_DN : public ASN1_Object
+ {
+ public:
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ std::multimap<OID, std::string> get_attributes() const;
+ std::vector<std::string> get_attribute(const std::string&) const;
+
+ std::multimap<std::string, std::string> contents() const;
+
+ void add_attribute(const std::string&, const std::string&);
+ void add_attribute(const OID&, const std::string&);
+
+ static std::string deref_info_field(const std::string&);
+
+ void do_decode(const MemoryRegion<byte>&);
+ MemoryVector<byte> get_bits() const;
+
+ X509_DN();
+ X509_DN(const std::multimap<OID, std::string>&);
+ X509_DN(const std::multimap<std::string, std::string>&);
+ private:
+ std::multimap<OID, ASN1_String> dn_info;
+ MemoryVector<byte> dn_bits;
+ };
+
+/*************************************************
+* Alternative Name *
+*************************************************/
+class BOTAN_DLL AlternativeName : public ASN1_Object
+ {
+ public:
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ std::multimap<std::string, std::string> contents() const;
+
+ void add_attribute(const std::string&, const std::string&);
+ std::multimap<std::string, std::string> get_attributes() const;
+
+ void add_othername(const OID&, const std::string&, ASN1_Tag);
+ std::multimap<OID, ASN1_String> get_othernames() const;
+
+ bool has_items() const;
+
+ AlternativeName(const std::string& = "", const std::string& = "",
+ const std::string& = "", const std::string& = "");
+ private:
+ std::multimap<std::string, std::string> alt_info;
+ std::multimap<OID, ASN1_String> othernames;
+ };
+
+/*************************************************
+* Comparison Operations *
+*************************************************/
+bool BOTAN_DLL operator==(const X509_Time&, const X509_Time&);
+bool BOTAN_DLL operator!=(const X509_Time&, const X509_Time&);
+bool BOTAN_DLL operator<=(const X509_Time&, const X509_Time&);
+bool BOTAN_DLL operator>=(const X509_Time&, const X509_Time&);
+
+bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&);
+bool BOTAN_DLL operator!=(const X509_DN&, const X509_DN&);
+bool BOTAN_DLL operator<(const X509_DN&, const X509_DN&);
+
+/*************************************************
+* Helper Functions *
+*************************************************/
+bool BOTAN_DLL is_string_type(ASN1_Tag);
+
+}
+
+#endif
diff --git a/src/asn1_oid.cpp b/src/asn1/asn1_oid.cpp
index 80968ed8f..80968ed8f 100644
--- a/src/asn1_oid.cpp
+++ b/src/asn1/asn1_oid.cpp
diff --git a/src/asn1/asn1_oid.h b/src/asn1/asn1_oid.h
new file mode 100644
index 000000000..73d0079a8
--- /dev/null
+++ b/src/asn1/asn1_oid.h
@@ -0,0 +1,50 @@
+/*************************************************
+* ASN.1 OID Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_ASN1_OID_H__
+#define BOTAN_ASN1_OID_H__
+
+#include <botan/asn1_int.h>
+#include <string>
+#include <vector>
+
+namespace Botan {
+
+/*************************************************
+* ASN.1 Object Identifier *
+*************************************************/
+class BOTAN_DLL OID : public ASN1_Object
+ {
+ public:
+ void encode_into(class DER_Encoder&) const;
+ void decode_from(class BER_Decoder&);
+
+ bool is_empty() const { return id.size() == 0; }
+ std::vector<u32bit> get_id() const { return id; }
+ std::string as_string() const;
+
+ bool operator==(const OID&) const;
+ void clear();
+
+ OID& operator+=(u32bit);
+ OID(const std::string& = "");
+ private:
+ std::vector<u32bit> id;
+ };
+
+/*************************************************
+* Append another component onto the OID *
+*************************************************/
+OID BOTAN_DLL operator+(const OID&, u32bit);
+
+/*************************************************
+* Compare two OIDs *
+*************************************************/
+bool BOTAN_DLL operator!=(const OID&, const OID&);
+bool BOTAN_DLL operator<(const OID&, const OID&);
+
+}
+
+#endif
diff --git a/src/asn1_str.cpp b/src/asn1/asn1_str.cpp
index 52dcdc55e..52dcdc55e 100644
--- a/src/asn1_str.cpp
+++ b/src/asn1/asn1_str.cpp
diff --git a/src/asn1_tm.cpp b/src/asn1/asn1_tm.cpp
index 7cd051af7..7cd051af7 100644
--- a/src/asn1_tm.cpp
+++ b/src/asn1/asn1_tm.cpp
diff --git a/src/ber_dec.cpp b/src/asn1/ber_dec.cpp
index c725a5af9..c725a5af9 100644
--- a/src/ber_dec.cpp
+++ b/src/asn1/ber_dec.cpp
diff --git a/src/asn1/ber_dec.h b/src/asn1/ber_dec.h
new file mode 100644
index 000000000..9fec75832
--- /dev/null
+++ b/src/asn1/ber_dec.h
@@ -0,0 +1,130 @@
+/*************************************************
+* BER Decoder Header File *
+* (C) 1999-2008 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_BER_DECODER_H__
+#define BOTAN_BER_DECODER_H__
+
+#include <botan/asn1_oid.h>
+#include <botan/data_src.h>
+#include <botan/enums.h>
+
+namespace Botan {
+
+/*************************************************
+* BER Decoding Object *
+*************************************************/
+class BOTAN_DLL BER_Decoder
+ {
+ public:
+ BER_Object get_next_object();
+ void push_back(const BER_Object&);
+
+ bool more_items() const;
+ BER_Decoder& verify_end();
+ BER_Decoder& discard_remaining();
+
+ BER_Decoder start_cons(ASN1_Tag, ASN1_Tag = UNIVERSAL);
+ BER_Decoder& end_cons();
+
+ BER_Decoder& raw_bytes(MemoryRegion<byte>&);
+
+ BER_Decoder& decode_null();
+ BER_Decoder& decode(bool&);
+ BER_Decoder& decode(u32bit&);
+ BER_Decoder& decode(class BigInt&);
+ BER_Decoder& decode(MemoryRegion<byte>&, ASN1_Tag);
+
+ BER_Decoder& decode(bool&, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ BER_Decoder& decode(u32bit&, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ BER_Decoder& decode(class BigInt&,
+ ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ BER_Decoder& decode(MemoryRegion<byte>&, ASN1_Tag,
+ ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+
+ BER_Decoder& decode(class ASN1_Object&);
+
+ template<typename T>
+ BER_Decoder& decode_optional(T&, ASN1_Tag, ASN1_Tag, const T& = T());
+
+ template<typename T>
+ BER_Decoder& decode_list(std::vector<T>&, bool = true);
+
+ BER_Decoder& decode_optional_string(MemoryRegion<byte>&,
+ ASN1_Tag, u16bit);
+
+ BER_Decoder(DataSource&);
+ BER_Decoder(const byte[], u32bit);
+ BER_Decoder(const MemoryRegion<byte>&);
+ BER_Decoder(const BER_Decoder&);
+ ~BER_Decoder();
+ private:
+ BER_Decoder& operator=(const BER_Decoder&) { return (*this); }
+
+ BER_Decoder* parent;
+ DataSource* source;
+ BER_Object pushed;
+ mutable bool owns;
+ };
+
+/*************************************************
+* Decode an OPTIONAL or DEFAULT element *
+*************************************************/
+template<typename T>
+BER_Decoder& BER_Decoder::decode_optional(T& out,
+ ASN1_Tag type_tag,
+ ASN1_Tag class_tag,
+ const T& default_value)
+ {
+ BER_Object obj = get_next_object();
+
+ if(obj.type_tag == type_tag && obj.class_tag == class_tag)
+ {
+ if(class_tag & CONSTRUCTED)
+ BER_Decoder(obj.value).decode(out).verify_end();
+ else
+ {
+ push_back(obj);
+ decode(out, type_tag, class_tag);
+ }
+ }
+ else
+ {
+ out = default_value;
+ push_back(obj);
+ }
+
+ return (*this);
+ }
+
+/*************************************************
+* Decode a list of homogenously typed values *
+*************************************************/
+template<typename T>
+BER_Decoder& BER_Decoder::decode_list(std::vector<T>& vec, bool clear_it)
+ {
+ if(clear_it)
+ vec.clear();
+
+ while(more_items())
+ {
+ T value;
+ decode(value);
+ vec.push_back(value);
+ }
+ return (*this);
+ }
+
+/*************************************************
+* BER Decoding Functions *
+*************************************************/
+namespace BER {
+
+void BOTAN_DLL decode(BER_Decoder&, Key_Constraints&);
+
+}
+
+}
+
+#endif
diff --git a/src/der_enc.cpp b/src/asn1/der_enc.cpp
index 1ab5ddd4e..1ab5ddd4e 100644
--- a/src/der_enc.cpp
+++ b/src/asn1/der_enc.cpp
diff --git a/src/asn1/der_enc.h b/src/asn1/der_enc.h
new file mode 100644
index 000000000..5b3c11489
--- /dev/null
+++ b/src/asn1/der_enc.h
@@ -0,0 +1,89 @@
+/*************************************************
+* DER Encoder Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_DER_ENCODER_H__
+#define BOTAN_DER_ENCODER_H__
+
+#include <botan/asn1_int.h>
+#include <vector>
+
+namespace Botan {
+
+/*************************************************
+* General DER Encoding Object *
+*************************************************/
+class BOTAN_DLL DER_Encoder
+ {
+ public:
+ SecureVector<byte> get_contents();
+
+ DER_Encoder& start_cons(ASN1_Tag, ASN1_Tag = UNIVERSAL);
+ DER_Encoder& end_cons();
+
+ DER_Encoder& start_explicit(u16bit);
+ DER_Encoder& end_explicit();
+
+ DER_Encoder& raw_bytes(const byte[], u32bit);
+ DER_Encoder& raw_bytes(const MemoryRegion<byte>&);
+
+ DER_Encoder& encode_null();
+ DER_Encoder& encode(bool);
+ DER_Encoder& encode(u32bit);
+ DER_Encoder& encode(const class BigInt&);
+ DER_Encoder& encode(const MemoryRegion<byte>&, ASN1_Tag);
+ DER_Encoder& encode(const byte[], u32bit, ASN1_Tag);
+
+ DER_Encoder& encode(bool, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ DER_Encoder& encode(u32bit, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ DER_Encoder& encode(const class BigInt&, ASN1_Tag,
+ ASN1_Tag = CONTEXT_SPECIFIC);
+ DER_Encoder& encode(const MemoryRegion<byte>&, ASN1_Tag,
+ ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ DER_Encoder& encode(const byte[], u32bit, ASN1_Tag,
+ ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+
+ template<typename T>
+ DER_Encoder& encode_optional(const T& value, const T& default_value)
+ {
+ if(value != default_value)
+ encode(value);
+ return (*this);
+ }
+
+ template<typename T>
+ DER_Encoder& encode_list(const std::vector<T>& values)
+ {
+ for(u32bit j = 0; j != values.size(); ++j)
+ encode(values[j]);
+ return (*this);
+ }
+
+ DER_Encoder& encode(const class ASN1_Object&);
+ DER_Encoder& encode_if(bool, DER_Encoder&);
+
+ DER_Encoder& add_object(ASN1_Tag, ASN1_Tag, const byte[], u32bit);
+ DER_Encoder& add_object(ASN1_Tag, ASN1_Tag, const MemoryRegion<byte>&);
+ DER_Encoder& add_object(ASN1_Tag, ASN1_Tag, const std::string&);
+ DER_Encoder& add_object(ASN1_Tag, ASN1_Tag, byte);
+ private:
+ class DER_Sequence
+ {
+ public:
+ ASN1_Tag tag_of() const;
+ SecureVector<byte> get_contents();
+ void add_bytes(const byte[], u32bit);
+ DER_Sequence(ASN1_Tag, ASN1_Tag);
+ private:
+ ASN1_Tag type_tag, class_tag;
+ SecureVector<byte> contents;
+ std::vector< SecureVector<byte> > set_contents;
+ };
+ SecureVector<byte> contents;
+ std::vector<DER_Sequence> subsequences;
+ };
+
+}
+
+#endif
diff --git a/src/asn1/modinfo.txt b/src/asn1/modinfo.txt
new file mode 100644
index 000000000..03284f48b
--- /dev/null
+++ b/src/asn1/modinfo.txt
@@ -0,0 +1,23 @@
+realname "ASN.1/BER/DER module"
+
+define ASN1
+
+<add>
+alg_id.cpp
+asn1_alt.cpp
+asn1_att.cpp
+asn1_dn.cpp
+asn1_int.cpp
+asn1_ku.cpp
+asn1_oid.cpp
+asn1_str.cpp
+asn1_tm.cpp
+ber_dec.cpp
+der_enc.cpp
+alg_id.h
+asn1_int.h
+asn1_obj.h
+asn1_oid.h
+ber_dec.h
+der_enc.h
+</add>
diff --git a/src/base64.cpp b/src/codec/base64/base64.cpp
index 0e01d94f3..0e01d94f3 100644
--- a/src/base64.cpp
+++ b/src/codec/base64/base64.cpp
diff --git a/src/codec/base64/base64.h b/src/codec/base64/base64.h
new file mode 100644
index 000000000..0003875a6
--- /dev/null
+++ b/src/codec/base64/base64.h
@@ -0,0 +1,60 @@
+/*************************************************
+* Base64 Encoder/Decoder Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_BASE64_H__
+#define BOTAN_BASE64_H__
+
+#include <botan/filter.h>
+#include <botan/enums.h>
+
+namespace Botan {
+
+/*************************************************
+* Base64 Encoder *
+*************************************************/
+class BOTAN_DLL Base64_Encoder : public Filter
+ {
+ public:
+ static void encode(const byte[3], byte[4]);
+
+ void write(const byte[], u32bit);
+ void end_msg();
+ Base64_Encoder(bool = false, u32bit = 72, bool = false);
+ private:
+ void encode_and_send(const byte[], u32bit);
+ void do_output(const byte[], u32bit);
+ static const byte BIN_TO_BASE64[64];
+
+ const u32bit line_length;
+ const bool trailing_newline;
+ SecureVector<byte> in, out;
+ u32bit position, counter;
+ };
+
+/*************************************************
+* Base64 Decoder *
+*************************************************/
+class BOTAN_DLL Base64_Decoder : public Filter
+ {
+ public:
+ static void decode(const byte[4], byte[3]);
+ static bool is_valid(byte);
+
+ void write(const byte[], u32bit);
+ void end_msg();
+ Base64_Decoder(Decoder_Checking = NONE);
+ private:
+ void decode_and_send(const byte[], u32bit);
+ void handle_bad_char(byte);
+ static const byte BASE64_TO_BIN[256];
+
+ const Decoder_Checking checking;
+ SecureVector<byte> in, out;
+ u32bit position;
+ };
+
+}
+
+#endif
diff --git a/src/codec/base64/modinfo.txt b/src/codec/base64/modinfo.txt
new file mode 100644
index 000000000..4e7b38584
--- /dev/null
+++ b/src/codec/base64/modinfo.txt
@@ -0,0 +1,10 @@
+realname "Base64 Codec"
+
+define BASE64_CODEC
+
+load_on auto
+
+<add>
+base64.cpp
+base64.h
+</add>
diff --git a/src/compress/bzip2/bzip2.cpp b/src/codec/bzip2/bzip2.cpp
index 712dacd7d..712dacd7d 100644
--- a/src/compress/bzip2/bzip2.cpp
+++ b/src/codec/bzip2/bzip2.cpp
diff --git a/src/compress/bzip2/bzip2.h b/src/codec/bzip2/bzip2.h
index 1244924ca..1244924ca 100644
--- a/src/compress/bzip2/bzip2.h
+++ b/src/codec/bzip2/bzip2.h
diff --git a/src/compress/bzip2/modinfo.txt b/src/codec/bzip2/modinfo.txt
index efedc097f..efedc097f 100644
--- a/src/compress/bzip2/modinfo.txt
+++ b/src/codec/bzip2/modinfo.txt
diff --git a/src/hex.cpp b/src/codec/hex/hex.cpp
index afb082f76..afb082f76 100644
--- a/src/hex.cpp
+++ b/src/codec/hex/hex.cpp
diff --git a/src/codec/hex/hex.h b/src/codec/hex/hex.h
new file mode 100644
index 000000000..0ecddb588
--- /dev/null
+++ b/src/codec/hex/hex.h
@@ -0,0 +1,64 @@
+/*************************************************
+* Hex Encoder/Decoder Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_HEX_H__
+#define BOTAN_HEX_H__
+
+#include <botan/filter.h>
+#include <botan/enums.h>
+
+namespace Botan {
+
+/*************************************************
+* Hex Encoder *
+*************************************************/
+class BOTAN_DLL Hex_Encoder : public Filter
+ {
+ public:
+ enum Case { Uppercase, Lowercase };
+ static void encode(byte, byte[2], Case = Uppercase);
+
+ void write(const byte[], u32bit);
+ void end_msg();
+
+ Hex_Encoder(Case);
+ Hex_Encoder(bool = false, u32bit = 72, Case = Uppercase);
+ private:
+ void encode_and_send(const byte[], u32bit);
+ static const byte BIN_TO_HEX_UPPER[16];
+ static const byte BIN_TO_HEX_LOWER[16];
+
+ const Case casing;
+ const u32bit line_length;
+ SecureVector<byte> in, out;
+ u32bit position, counter;
+ };
+
+/*************************************************
+* Hex Decoder *
+*************************************************/
+class BOTAN_DLL Hex_Decoder : public Filter
+ {
+ public:
+ static byte decode(const byte[2]);
+ static bool is_valid(byte);
+
+ void write(const byte[], u32bit);
+ void end_msg();
+
+ Hex_Decoder(Decoder_Checking = NONE);
+ private:
+ void decode_and_send(const byte[], u32bit);
+ void handle_bad_char(byte);
+ static const byte HEX_TO_BIN[256];
+
+ const Decoder_Checking checking;
+ SecureVector<byte> in, out;
+ u32bit position;
+ };
+
+}
+
+#endif
diff --git a/src/codec/hex/modinfo.txt b/src/codec/hex/modinfo.txt
new file mode 100644
index 000000000..e0b07a552
--- /dev/null
+++ b/src/codec/hex/modinfo.txt
@@ -0,0 +1,10 @@
+realname "Hex Codec"
+
+define HEX_CODEC
+
+load_on auto
+
+<add>
+hex.cpp
+hex.h
+</add>
diff --git a/src/compress/zlib/modinfo.txt b/src/codec/zlib/modinfo.txt
index c1f1f998c..c1f1f998c 100644
--- a/src/compress/zlib/modinfo.txt
+++ b/src/codec/zlib/modinfo.txt
diff --git a/src/compress/zlib/zlib.cpp b/src/codec/zlib/zlib.cpp
index 36a9640e3..36a9640e3 100644
--- a/src/compress/zlib/zlib.cpp
+++ b/src/codec/zlib/zlib.cpp
diff --git a/src/compress/zlib/zlib.h b/src/codec/zlib/zlib.h
index c3baea4ee..c3baea4ee 100644
--- a/src/compress/zlib/zlib.h
+++ b/src/codec/zlib/zlib.h
diff --git a/src/pk/dl_algo/modinfo.txt b/src/pk/dl_algo/modinfo.txt
new file mode 100644
index 000000000..755ab8682
--- /dev/null
+++ b/src/pk/dl_algo/modinfo.txt
@@ -0,0 +1,15 @@
+realname "Discrete Logarithm PK Algorithms"
+
+define DL_PUBLIC_KEY_FAMILY
+
+load_on auto
+
+<add>
+dl_algo.cpp
+dl_algo.h
+</add>
+
+<requires>
+asn1
+dl_group
+</requires>
diff --git a/src/pk/dl_group/modinfo.txt b/src/pk/dl_group/modinfo.txt
new file mode 100644
index 000000000..4d2d6f13c
--- /dev/null
+++ b/src/pk/dl_group/modinfo.txt
@@ -0,0 +1,10 @@
+realname "DL Group"
+
+load_on auto
+
+define DL_GROUP
+
+<add>
+dl_group.cpp
+dl_group.h
+</add>
diff --git a/src/pk/dlies/modinfo.txt b/src/pk/dlies/modinfo.txt
index 995dbe8a2..163914714 100644
--- a/src/pk/dlies/modinfo.txt
+++ b/src/pk/dlies/modinfo.txt
@@ -8,3 +8,7 @@ load_on auto
dlies.cpp
dlies.h
</add>
+
+<requires>
+asn1
+</requires>