aboutsummaryrefslogtreecommitdiffstats
path: root/include/asn1_oid.h
blob: 43630ad2df5c685a15b8447d5a3c436e836b919e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*************************************************
* ASN.1 OID Header File                          *
* (C) 1999-2007 The Botan Project                *
*************************************************/

#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 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 operator+(const OID&, u32bit);

/*************************************************
* Compare two OIDs                               *
*************************************************/
bool operator!=(const OID&, const OID&);
bool operator<(const OID&, const OID&);

}

#endif