pub struct IndefiniteLength(Option<Length>);Expand description
Length type with support for indefinite lengths as used by ASN.1 BER, as described in X.690 Section 8.1.3.6:
8.1.3.6 For the indefinite form, the length octets indicate that the contents octets are terminated by end-of-contents octets (see 8.1.5), and shall consist of a single octet.
8.1.3.6.1 The single octet shall have bit 8 set to one, and bits 7 to 1 set to zero.
8.1.3.6.2 If this form of length is used, then end-of-contents octets (see 8.1.5) shall be present in the encoding following the contents octets.
Indefinite lengths are non-canonical and therefore invalid DER, however there are interoperability corner cases where we have little choice but to tolerate some BER productions where this is helpful.
Tuple Fields§
§0: Option<Length>Implementations§
Source§impl IndefiniteLength
impl IndefiniteLength
Sourcepub fn new(length: impl Into<Length>) -> Self
pub fn new(length: impl Into<Length>) -> Self
Create a definite length from a type which can be converted into a
Length.
Sourcepub fn is_definite(self) -> bool
pub fn is_definite(self) -> bool
Is this length definite?
Sourcepub fn is_indefinite(self) -> bool
pub fn is_indefinite(self) -> bool
Is this length indefinite?
Trait Implementations§
Source§impl Clone for IndefiniteLength
impl Clone for IndefiniteLength
Source§fn clone(&self) -> IndefiniteLength
fn clone(&self) -> IndefiniteLength
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IndefiniteLength
impl Debug for IndefiniteLength
Source§impl<'a> Decode<'a> for IndefiniteLength
impl<'a> Decode<'a> for IndefiniteLength
Source§impl Encode for IndefiniteLength
impl Encode for IndefiniteLength
Source§fn encoded_len(&self) -> Result<Length>
fn encoded_len(&self) -> Result<Length>
Source§fn encode(&self, writer: &mut impl Writer) -> Result<()>
fn encode(&self, writer: &mut impl Writer) -> Result<()>
Writer.