[][src]Struct pkcs8::ObjectIdentifier

pub struct ObjectIdentifier { /* fields omitted */ }

Object identifier (OID)

Implementations

impl ObjectIdentifier[src]

pub const fn new(nodes: &[u32]) -> ObjectIdentifier[src]

Create an OID from a slice of integers.

Panics

To enable const fn usage and work around current limitations thereof, this method panics in the event the OID is malformed.

For that reason this method is not recommended except for use in constants (where it will generate a compiler error instead). To parse an OID from a &[u32] slice without panicking on error, use TryFrom<&[u32]> instead.

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

  • The OID MUST have at least 3 nodes
  • The OID MUST NOT have more nodes than the MAX_NODES constant
  • The first node MUST be within the range 0-2
  • The second node MUST be within the range 0-39

pub fn from_ber(bytes: &[u8]) -> Result<ObjectIdentifier, Error>[src]

Parse an OID from from its BER/DER encoding.

pub fn ber_len(&self) -> usize[src]

Get the length of this OID when serialized as ASN.1 BER

pub fn write_ber(&self, bytes: &'a mut [u8]) -> Result<&'a [u8], Error>[src]

Write the BER encoding of this OID into the given slice, returning a new slice containing the written data

pub fn to_ber(&self) -> Vec<u8, Global>[src]

Serialize this OID as ASN.1 BER

Trait Implementations

impl AsRef<[u32]> for ObjectIdentifier[src]

impl Clone for ObjectIdentifier[src]

impl Copy for ObjectIdentifier[src]

impl Debug for ObjectIdentifier[src]

impl Display for ObjectIdentifier[src]

impl Eq for ObjectIdentifier[src]

impl FromStr for ObjectIdentifier[src]

type Err = Error

The associated error which can be returned from parsing.

impl PartialEq<ObjectIdentifier> for ObjectIdentifier[src]

impl StructuralEq for ObjectIdentifier[src]

impl StructuralPartialEq for ObjectIdentifier[src]

impl<'_> TryFrom<&'_ [u32]> for ObjectIdentifier[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.