aboutsummaryrefslogtreecommitdiffstats
path: root/include/asn1_oid.h
blob: 92dbbecc0feecc4fb860c3634118dfdc4fc74e87 (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 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 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