monotone

monotone Mtn Source Tree

Root/botan/asn1_int.h

1/*************************************************
2* ASN.1 Internals Header File *
3* (C) 1999-2006 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_ASN1_H__
7#define BOTAN_ASN1_H__
8
9#include <botan/secmem.h>
10#include <botan/enums.h>
11#include <botan/exceptn.h>
12
13namespace Botan {
14
15/*************************************************
16* Basic ASN.1 Object Interface *
17*************************************************/
18class ASN1_Object
19 {
20 public:
21 virtual void encode_into(class DER_Encoder&) const = 0;
22 virtual void decode_from(class BER_Decoder&) = 0;
23 virtual ~ASN1_Object() {}
24 };
25
26/*************************************************
27* BER Encoded Object *
28*************************************************/
29class BER_Object
30 {
31 public:
32 void assert_is_a(ASN1_Tag, ASN1_Tag);
33
34 ASN1_Tag type_tag, class_tag;
35 SecureVector<byte> value;
36 };
37
38/*************************************************
39* ASN.1 Utility Functions *
40*************************************************/
41class DataSource;
42
43namespace ASN1 {
44
45SecureVector<byte> put_in_sequence(const MemoryRegion<byte>&);
46std::string to_string(const BER_Object&);
47bool maybe_BER(DataSource&);
48
49}
50
51/*************************************************
52* General BER Decoding Error Exception *
53*************************************************/
54struct BER_Decoding_Error : public Decoding_Error
55 {
56 BER_Decoding_Error(const std::string&);
57 };
58
59/*************************************************
60* Exception For Incorrect BER Taggings *
61*************************************************/
62struct BER_Bad_Tag : public BER_Decoding_Error
63 {
64 BER_Bad_Tag(const std::string&, ASN1_Tag);
65 BER_Bad_Tag(const std::string&, ASN1_Tag, ASN1_Tag);
66 };
67
68}
69
70#endif

Archive Download this file

Branches

Tags

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