Struct der_parser::DerObject [] [src]

pub struct DerObject<'a> {
    pub class: u8,
    pub structured: u8,
    pub tag: u8,
    pub content: DerObjectContent<'a>,
}

Representation of a DER-encoded (X.690) object

Fields

Methods

impl<'a> DerObject<'a>
[src]

[src]

Build a DerObject from a header and content. Note: values are not checked, so the tag can be different from the real content, or flags can be invalid.

[src]

Build a DerObject from its content, using default flags (no class, correct tag, and structured flag set only for Set and Sequence)

[src]

Build a DER integer object from a slice containing an encoded integer

[src]

Build a DER sequence object from a vector of DER objects

[src]

Build a DER set object from a vector of DER objects

[src]

Attempt to read integer value from DER object. This can fail if the object is not an integer, or if it is too large.

let der_int  = DerObject::from_obj(DerObjectContent::Integer(b"\x01\x00\x01"));
assert_eq!(
    der_int.as_u64(),
    Ok(0x10001)
);

[src]

Attempt to read integer value from DER object. This can fail if the object is not an integer, or if it is too large.

let der_int  = DerObject::from_obj(DerObjectContent::Integer(b"\x01\x00\x01"));
assert_eq!(
    der_int.as_u32(),
    Ok(0x10001)
);

[src]

Attempt to read integer value from DER object. This can fail if the object is not a boolean.

[src]

Attempt to read an OID value from DER object. This can fail if the object is not an OID.

Note that this function returns a reference to the OID. To get an owned value, use as_oid_val

[src]

Attempt to read an OID value from DER object. This can fail if the object is not an OID.

[src]

Attempt to read the content from a context-specific DER object. This can fail if the object is not context-specific.

Note: the object is cloned.

[src]

Attempt to extract the list of objects from a DER sequence. This can fail if the object is not a sequence.

[src]

Attempt to extract the list of objects from a DER set. This can fail if the object is not a set.

[src]

Attempt to get the content from a DER object, as a slice. This can fail if the object does not contain a type directly equivalent to a slice (e.g a sequence). This function mostly concerns string types, integers, or unknown DER objects.

[src]

Test if object class is Universal

[src]

Test if object class is Application

[src]

Test if object class is Context-specific

[src]

Test if object class is Private

[src]

Test if object is primitive

[src]

Test if object is constructed

impl<'a> DerObject<'a>
[src]

Important traits for DerObjectRefIterator<'a>
[src]

impl<'a> DerObject<'a>
[src]

[src]

Trait Implementations

impl<'a> Debug for DerObject<'a>
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a> Clone for DerObject<'a>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> PartialEq for DerObject<'a>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<'a> From<Oid> for DerObject<'a>
[src]

Build a DER object from an OID.

[src]

Performs the conversion.

impl<'a> IntoIterator for DerObject<'a>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

impl<'a> Index<usize> for DerObject<'a>
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

Auto Trait Implementations

impl<'a> Send for DerObject<'a>

impl<'a> Sync for DerObject<'a>