Struct der::asn1::ObjectIdentifier

source ·
pub struct ObjectIdentifier { /* private fields */ }
Available on crate feature oid only.
Expand description

Object identifier (OID).

OIDs are hierarchical structures consisting of “arcs”, i.e. integer identifiers.

Validity

In order for an OID to be considered valid by this library, it must meet the following criteria:

  • The OID MUST have at least 3 arcs
  • The first arc MUST be within the range 0-2
  • The second arc MUST be within the range 0-39
  • The BER/DER encoding of the OID MUST be shorter than ObjectIdentifier::MAX_SIZE

Implementations§

Maximum size of a BER/DER-encoded OID in bytes.

Parse an ObjectIdentifier from the dot-delimited string form, panicking on parse errors.

This function exists as a workaround for unwrap not yet being stable in const fn contexts, and is intended to allow the result to be bound to a constant value:

use const_oid::ObjectIdentifier;

pub const MY_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.113549.1.1.1");

In future versions of Rust it should be possible to replace this with ObjectIdentifier::new(...).unwrap().

Use ObjectIdentifier::new for fallible parsing.

Parse an ObjectIdentifier from the dot-delimited string form.

Parse an OID from a slice of Arc values (i.e. integers).

Parse an OID from from its BER/DER encoding.

Get the BER/DER serialization of this OID as bytes.

Note that this encoding omits the tag/length, and only contains the value portion of the encoded OID.

Return the arc with the given index, if it exists.

Iterate over the arcs (a.k.a. nodes) of an ObjectIdentifier.

Returns Arcs, an iterator over Arc values.

Get the length of this ObjectIdentifier in arcs.

Get the parent OID of this one (if applicable).

Push an additional arc onto this OID, returning the child OID.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Attempt to decode this message using the provided Reader.
Formats the value using the given formatter. Read more
Compute the length of this value (sans Tag+Length header) when encoded as ASN.1 DER. Read more
Encode value (sans Tag+Length header) as ASN.1 DER using the provided Writer. Read more
Get the Header used to encode this value.
ASN.1 tag
Converts to this type from the input type.
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.