A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.rs/der-parser/latest/der_parser/ber/struct.BerObject.html below:

BerObject in der_parser::ber - Rust

pub struct BerObject<'a> {
    pub header: Header<'a>,
    pub content: BerObjectContent<'a>,
}
Expand description

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

A BER object is composed of a header describing the object class, type and length, and the content.

Note that the content may sometimes not match the header tag (for ex when parsing IMPLICIT tagged values).

Source§ Source

Build a BerObject 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.

Source

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

Source

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

Source

Set a tag for the BER object

Source

Build a DER sequence object from a vector of DER objects

Source

Build a DER set object from a vector of DER objects

Source

Attempt to read a signed integer value from DER object.

This can fail if the object is not an integer, or if it is too large.

§Examples
let der_int  = BerObject::from_int_slice(b"\x80");
assert_eq!(
    der_int.as_i64(),
    Ok(-128)
);
Source

Attempt to read a signed integer value from DER object.

This can fail if the object is not an integer, or if it is too large.

§Examples
let der_int  = BerObject::from_int_slice(b"\x80");
assert_eq!(
    der_int.as_i32(),
    Ok(-128)
);
Source

Attempt to read integer value from DER object.

This can fail if the object is not an unsigned integer, or if it is too large.

§Examples
let der_int  = BerObject::from_int_slice(b"\x01\x00\x01");
assert_eq!(
    der_int.as_u64(),
    Ok(0x10001)
);
Source

Attempt to read integer value from DER object.

This can fail if the object is not an unsigned integer, or if it is too large.

§Examples
let der_int  = BerObject::from_obj(BerObjectContent::Integer(b"\x01\x00\x01"));
assert_eq!(
    der_int.as_u32(),
    Ok(0x10001)
);
Source

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

Source

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

Source

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

Source

Attempt to get a reference on the content from an optional object. This can fail if the object is not optional.

Source

Attempt to get a reference on the content from a tagged object. This can fail if the object is not tagged.

Source

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

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

Source

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

Source

Constructs a shared &BitSlice reference over the object data, if available as slice.

Source

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

Source

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

Source

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.

Source

Attempt to get the content from a DER object, as a str. This can fail if the object does not contain a string type.

Only some string types are considered here. Other string types can be read using as_slice.

Source

Get the BER object header’s class.

Source

Get the BER object header’s tag.

Source

Get the BER object header’s length.

Source

Test if object class is Universal

Source

Test if object class is Application

Source

Test if object class is Context-specific

Source

Test if object class is Private

Source

Test if object is primitive

Source

Test if object is constructed

Source

Return error if class is not the expected class

Source

Return error if tag is not the expected tag

Source

Return error if object is not constructed

Source

Return error if object is not primitive

Source§ Source

Available on crate feature bigint only.

Attempt to read an integer value from this object.

This can fail if the object is not an integer.

§Examples
use der_parser::ber::*;

let data = &[0x02, 0x03, 0x01, 0x00, 0x01];

let (_, object) = parse_ber_integer(data).expect("parsing failed");
assert_eq!(object.as_bigint(), Ok(65537.into()))
Source

Available on crate feature bigint only.

Attempt to read a positive integer value from this object.

This can fail if the object is not an integer, or is negative.

§Examples
use der_parser::ber::*;

let data = &[0x02, 0x03, 0x01, 0x00, 0x01];

let (_, object) = parse_ber_integer(data).expect("parsing failed");
assert_eq!(object.as_biguint(), Ok(65537_u32.into()))
Source§ Source§ Source§ Source

Available on crate feature serialize only.

Attempt to encode object as BER

Note that the encoding will not check that the values of the BerObject fields are correct. The length is automatically calculated, and the field is ignored.

Tagged objects will be encoded as EXPLICIT.

This function is only available if the serialize feature is enabled.

Source§ Source§ Source§

Build a DER object from a BerObjectContent.

Source§

Converts to this type from the input type.

Source§

Build a DER object from an OID.

Source§

Converts to this type from the input type.

Source§ Source§ Source§

The type of the elements being iterated over.

Source§

Which kind of iterator are we turning this into?

Source§ Source§ Source§

Tests for self and other values to be equal, and is used by ==.

1.0.0 · Source§

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Source§ Source§

The type returned in the event of a conversion error.

Source§

Performs the conversion.

Source§ Source§

The type returned in the event of a conversion error.

Source§

Performs the conversion.

Source§ Source§ Source§ Source§ Source§ Source§ Source§ Source§

🔬This is a nightly-only experimental API. (clone_to_uninit)

Performs copy-assignment from

self

to

dest

.

Read more Source§ Source§ Source§

Causes self to use its Binary implementation when Debug-formatted.

Source§

Causes self to use its Display implementation when Debug-formatted.

Source§

Causes self to use its LowerExp implementation when Debug-formatted.

Source§

Causes self to use its LowerHex implementation when Debug-formatted.

Source§

Causes self to use its Octal implementation when Debug-formatted.

Source§

Causes self to use its Pointer implementation when Debug-formatted.

Source§

Causes self to use its UpperExp implementation when Debug-formatted.

Source§

Causes self to use its UpperHex implementation when Debug-formatted.

Source§ Source§ Source§

Returns the argument unchanged.

Source§ Source§

Attempt to parse input bytes into a BER object

Source§ Source§

Calls U::from(self).

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

Source§ Source§

Pipes by value. This is generally the method you want to use.

Read more Source§

Borrows

self

and passes that borrow into the pipe function.

Read more Source§

Mutably borrows

self

and passes that borrow into the pipe function.

Read more Source§

Borrows

self

, then passes

self.borrow()

into the pipe function.

Read more Source§

Mutably borrows

self

, then passes

self.borrow_mut()

into the pipe function.

Read more Source§

Borrows self, then passes self.as_ref() into the pipe function.

Source§

Mutably borrows self, then passes self.as_mut() into the pipe function.

Source§

Borrows self, then passes self.deref() into the pipe function.

Source§

Mutably borrows self, then passes self.deref_mut() into the pipe function.

Source§ Source§ Source§ Source§

Immutable access to the

Borrow<B>

of a value.

Read more Source§

Mutable access to the

BorrowMut<B>

of a value.

Read more Source§

Immutable access to the

AsRef<R>

view of a value.

Read more Source§

Mutable access to the

AsMut<R>

view of a value.

Read more Source§

Immutable access to the

Deref::Target

of a value.

Read more Source§

Mutable access to the

Deref::Target

of a value.

Read more Source§

Calls .tap() only in debug builds, and is erased in release builds.

Source§

Calls .tap_mut() only in debug builds, and is erased in release builds.

Source§

Calls .tap_borrow() only in debug builds, and is erased in release builds.

Source§

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.

Source§

Calls .tap_ref() only in debug builds, and is erased in release builds.

Source§

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.

Source§

Calls .tap_deref() only in debug builds, and is erased in release builds.

Source§

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.

Source§ Source§

The resulting type after obtaining ownership.

Source§

Creates owned data from borrowed data, usually by cloning.

Read more Source§

Uses borrowed data to replace owned data, usually by cloning.

Read more Source§ Source§ Source§

The type returned in the event of a conversion error.

Source§

Performs the conversion.

Source§ Source§

The type returned in the event of a conversion error.

Source§

Performs the conversion.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4