OID Class Reference

Object Identifier. More...

`#include <asn.h>`

## Public Member Functions

| OID ()
| Construct an OID.
| OID (word32 v)
| Construct an OID.
| OID (BufferedTransformation &bt)
| Construct an OID.
OID & | operator+= (word32 rhs)
| Append a value to an OID.
void | DEREncode (BufferedTransformation &bt) const
| DER encode this OID.
void | BERDecode (BufferedTransformation &bt)
| BER decode an OID.
void | BERDecodeAndCheck (BufferedTransformation &bt) const
| BER decode an OID.
bool | Empty () const
| Determine if OID is empty.
const std::vector< word32 > & | GetValues () const
| Retrieve OID value array.
std::ostream & | Print (std::ostream &out) const
| Print an OID.

## Friends

bool | operator== (const OID &lhs, const OID &rhs)
| Compare two OIDs for equality.
bool | operator!= (const OID &lhs, const OID &rhs)
| Compare two OIDs for inequality.
bool | operator< (const OID &lhs, const OID &rhs)
| Compare two OIDs for ordering.
bool | operator<= (const OID &lhs, const OID &rhs)
| Compare two OIDs for ordering.
bool | operator>= (const OID &lhs, const OID &rhs)
| Compare two OIDs for ordering.

## Detailed Description

Object Identifier.

Definition at line 264 of file asn.h.

## Constructor & Destructor Documentation

## ~OID()

virtual OID::~OID | ( |  | ) |

inline virtual

Definition at line 267 of file asn.h.

## OID() [1/3]

OID::OID | ( |  | ) |

inline

Construct an OID.

Definition at line 270 of file asn.h.

## OID() [2/3]

OID::OID | ( | word32 | v | ) |

inline

Construct an OID.

Parameters

  v | value to initialize the OID

Definition at line 274 of file asn.h.

## OID() [3/3]

OID::OID | ( | BufferedTransformation & | bt | ) |

inline

Construct an OID.

Parameters

  bt | BufferedTransformation object

Definition at line 278 of file asn.h.

## Member Function Documentation

## operator+=()

OID & OID::operator+= | ( | word32 | rhs | ) |

inline

Append a value to an OID.

Parameters

  rhs | the value to append

Definition at line 284 of file asn.h.

## DEREncode()

void OID::DEREncode | ( | BufferedTransformation & | bt | ) | const

DER encode this OID.

Parameters

  bt | BufferedTransformation object

## BERDecode()

void OID::BERDecode | ( | BufferedTransformation & | bt | ) |

BER decode an OID.

Parameters

  bt | BufferedTransformation object

## BERDecodeAndCheck()

void OID::BERDecodeAndCheck | ( | BufferedTransformation & | bt | ) | const

BER decode an OID.

Parameters

  bt | BufferedTransformation object

Exceptions

  BERDecodeErr() | if decoded value doesn't match an expected OID

BERDecodeAndCheck() can be used to parse an OID and verify it matches an expected.

      BERSequenceDecoder key(bt);
      ...
      BERSequenceDecoder algorithm(key);
      GetAlgorithmID().BERDecodeAndCheck(algorithm);

## Empty()

bool OID::Empty | ( |  | ) | const

inline

Determine if OID is empty.

Returns
  true if OID has 0 elements, false otherwise

Since
  Crypto++ 8.0

Definition at line 311 of file asn.h.

## GetValues()

const std::vector< word32 > & OID::GetValues | ( |  | ) | const

inline

Retrieve OID value array.

Returns
  OID value vector

Since
  Crypto++ 8.0

Definition at line 318 of file asn.h.

## Print()

std::ostream & OID::Print | ( | std::ostream & | out | ) | const

Print an OID.

Parameters

  out | ostream object

Returns
  ostream reference

Print() writes the OID in a customary format, like 1.2.840.113549.1.1.11. The caller is reposnsible to convert the OID to a friendly name, like sha256WithRSAEncryption.

Since
  Crypto++ 8.3

## Friends And Related Symbol Documentation

## operator==

bool operator== | ( | const OID & | lhs,
|  | const OID & | rhs
| ) |  |

friend

Compare two OIDs for equality.

Parameters

  lhs | the first OID
  rhs | the second OID

Returns
  true if the OIDs are equal, false otherwise

## operator!=

bool operator!= | ( | const OID & | lhs,
|  | const OID & | rhs
| ) |  |

friend

Compare two OIDs for inequality.

Parameters

  lhs | the first OID
  rhs | the second OID

Returns
  true if the OIDs are not equal, false otherwise

## operator<

bool operator< | ( | const OID & | lhs,
|  | const OID & | rhs
| ) |  |

friend

Compare two OIDs for ordering.

Parameters

  lhs | the first OID
  rhs | the second OID

Returns
  true if the first OID is less than the second OID, false otherwise

operator<() calls std::lexicographical_compare() on each element in the array of values.

## operator<=

bool operator<= | ( | const OID & | lhs,
|  | const OID & | rhs
| ) |  |

friend

Compare two OIDs for ordering.

Parameters

  lhs | the first OID
  rhs | the second OID

Returns
  true if the first OID is less than or equal to the second OID, false otherwise

operator<=() is implemented in terms of operator==() and operator<().

Since
  Crypto++ 8.3

## operator>=

bool operator>= | ( | const OID & | lhs,
|  | const OID & | rhs
| ) |  |

friend

Compare two OIDs for ordering.

Parameters

  lhs | the first OID
  rhs | the second OID

Returns
  true if the first OID is greater than or equal to the second OID, false otherwise

operator>=() is implemented in terms of operator<().

Since
  Crypto++ 8.3

The documentation for this class was generated from the following file:

- asn.h