8 #include <botan/asn1_oid.h>
9 #include <botan/der_enc.h>
10 #include <botan/ber_dec.h>
11 #include <botan/internal/bit_ops.h>
12 #include <botan/parsing.h>
32 if(
id.size() < 2 ||
id[0] > 2)
34 if((
id[0] == 0 ||
id[0] == 1) &&
id[1] > 39)
53 for(
size_t i = 0; i !=
id.size(); ++i)
56 if(i !=
id.size() - 1)
67 if(
id.size() != oid.id.size())
69 for(
size_t i = 0; i !=
id.size(); ++i)
70 if(
id[i] != oid.id[i])
80 id.push_back(component);
107 std::vector<u32bit> oid1 = a.
get_id();
108 std::vector<u32bit> oid2 = b.
get_id();
110 if(oid1.size() < oid2.size())
112 if(oid1.size() > oid2.size())
114 for(
size_t i = 0; i != oid1.size(); ++i)
116 if(oid1[i] < oid2[i])
118 if(oid1[i] > oid2[i])
135 for(
size_t i = 2; i !=
id.size(); ++i)
141 size_t blocks =
high_bit(
id[i]) + 6;
142 blocks = (blocks - (blocks % 7)) / 7;
144 for(
size_t j = 0; j != blocks - 1; ++j)
145 encoding.
push_back(0x80 | ((
id[i] >> 7*(blocks-j-1)) & 0x7F));
159 throw BER_Bad_Tag(
"Error decoding OID, unknown tag",
166 id.push_back(obj.
value[0] / 40);
167 id.push_back(obj.
value[0] % 40);
176 component = (component << 7) + (obj.
value[i] & 0x7F);
177 if(!(obj.
value[i] & 0x80))
180 id.push_back(component);
bool operator!=(const OctetString &s1, const OctetString &s2)
void encode_into(class DER_Encoder &) const
std::invalid_argument Invalid_Argument
void decode_from(class BER_Decoder &)
OctetString operator+(const OctetString &k1, const OctetString &k2)
OID(const std::string &str="")
OID & operator+=(u32bit new_comp)
SecureVector< byte > value
bool operator==(const OID &) const
BER_Object get_next_object()
bool BOTAN_DLL operator<(const X509_Time &, const X509_Time &)
std::string as_string() const
std::string to_string(u64bit n, size_t min_len)
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const byte rep[], size_t length)
std::vector< u32bit > parse_asn1_oid(const std::string &oid)
std::vector< u32bit > get_id() const