Skip to main content

set_ordered

Function set_ordered 

Source
pub fn set_ordered(
    parent: &Reader<'_>,
    previous: &[u8],
    next: &Element<'_>,
    field: &'static str,
) -> Result<bool>
Expand description

Whether two members of a set are in the order the distinguished rules put them in.

“The encodings of the component values of a set-of value shall appear in ascending order” (X.690 11.6), comparing octet by octet with the shorter encoding treated as though padded with zeros.

It is separate from conforms because a set is not always written under a set’s own tag: a signed message writes its attributes under a context tag and signs them under SET OF, so the ordering is the schema’s to check where the tag no longer says so.

parent supplies the current execution account and original parser-local cumulative ceiling. Before comparison, one work unit per possible octet pair is admitted: the longer length, because X.690 compares the shorter encoding with virtual zero padding. A minimum of one unit covers an empty comparison. This is an upper bound; an unequal pair may stop the walk early. parent must belong to the session and source that produced next; this is a caller precondition, not a provenance check.

§Errors

Returns a resource refusal at next’s original offset before comparing bytes. Ok(false) means incorrect order, independently of resource errors.