diff options
author | lloyd <[email protected]> | 2008-09-28 22:14:54 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 22:14:54 +0000 |
commit | 31204986023619c385d378e79a6511bb81ef7b78 (patch) | |
tree | ce272a6585dc070f750f6875b0450d53145b935d /src/asn1_int.cpp | |
parent | 42c0fe76ab6d9625d0e51c68b8dd187322c991bd (diff) |
Move almost all of the ASN.1, BER, and DER codec related code into new
module asn1
Move hex and base64 codecs into new codecs directory. Also move zlib and
bzip2 to codecs from compress.
Diffstat (limited to 'src/asn1_int.cpp')
-rw-r--r-- | src/asn1_int.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/asn1_int.cpp b/src/asn1_int.cpp deleted file mode 100644 index e837dedf0..000000000 --- a/src/asn1_int.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************* -* ASN.1 Internals Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#include <botan/asn1_int.h> -#include <botan/der_enc.h> -#include <botan/ber_dec.h> -#include <botan/data_src.h> -#include <botan/parsing.h> - -namespace Botan { - -/************************************************* -* BER Decoding Exceptions * -*************************************************/ -BER_Decoding_Error::BER_Decoding_Error(const std::string& str) : - Decoding_Error("BER: " + str) {} - -BER_Bad_Tag::BER_Bad_Tag(const std::string& str, ASN1_Tag tag) : - BER_Decoding_Error(str + ": " + to_string(tag)) {} - -BER_Bad_Tag::BER_Bad_Tag(const std::string& str, - ASN1_Tag tag1, ASN1_Tag tag2) : - BER_Decoding_Error(str + ": " + to_string(tag1) + "/" + to_string(tag2)) {} - -namespace ASN1 { - -/************************************************* -* Put some arbitrary bytes into a SEQUENCE * -*************************************************/ -SecureVector<byte> put_in_sequence(const MemoryRegion<byte>& contents) - { - return DER_Encoder() - .start_cons(SEQUENCE) - .raw_bytes(contents) - .end_cons() - .get_contents(); - } - -/************************************************* -* Convert a BER object into a string object * -*************************************************/ -std::string to_string(const BER_Object& obj) - { - return std::string(reinterpret_cast<const char*>(obj.value.begin()), - obj.value.size()); - } - -/************************************************* -* Do heuristic tests for BER data * -*************************************************/ -bool maybe_BER(DataSource& source) - { - byte first_byte; - if(!source.peek_byte(first_byte)) - throw Stream_IO_Error("ASN1::maybe_BER: Source was empty"); - - if(first_byte == (SEQUENCE | CONSTRUCTED)) - return true; - return false; - } - -} - -} |