pub enum ASN1ErrorCode {
Show 54 variants
io,
tlv_truncated,
tag_too_big,
length_too_big,
value_too_big,
field_too_big,
value_too_short,
malformed_value,
padding_in_tag_number,
tag_number_could_have_used_short_form,
string_constructed_with_invalid_tagging,
invalid_construction,
unrecognized_components_in_inextensible_type,
unrecognized_alternative_in_inextensible_choice,
prohibited_character(u32, usize),
construction_too_complex,
duplicate_tags_in_set,
duplicate_components,
missing_required_components,
int_padding,
der_boolean_not_0x00_or_0xFF,
oid_padding,
unrecognized_special_real,
bin_real_unrecognized_base,
bin_real_unrecognized_exp_fmt,
base_10_real_string_malformed(Vec<u8>),
base_10_real_unrecognized_format(u8),
base_10_real_unrecognized_base(u8),
x690_long_form_unnecessary,
x690_indefinite_length_but_not_constructed,
x690_boolean_not_one_byte,
x690_bit_string_remainder_gt_7,
x690_bit_string_remainder_but_no_bits,
x690_bit_string_zero_bytes,
x690_bit_string_non_terminal_segment_with_trailing_bits,
invalid_year,
invalid_month,
invalid_day,
invalid_hour,
invalid_minute,
invalid_second,
invalid_fraction_of_seconds,
invalid_time_offset,
invalid_utf8(Option<Utf8Error>),
nonsense,
constraint_violation,
trailing_content_octets,
invalid_duration_component(char),
invalid_oid_arc,
indefinite_length_prohibited,
bit_string_trailing_bits_set,
real_format_prohibited,
real_base_prohibited,
unrecognized_universal_type,
}Expand description
The overall ASN.1 error type
Variants§
io
Some kind of I/O error
tlv_truncated
The encoding was truncated. This is NOT to be used when there are enough bytes of content octets for the length, but the content contained therein is invalid. This is for when the whole Tag-Length-Value (TLV) is truncated.
tag_too_big
The tag was too big
length_too_big
The length of an encoded value was too big
value_too_big
The value encoded was too big, such as by overflowing an integer, or exceeding some other bounds imposed by the library.
field_too_big
A field within an encoded value was too large
value_too_short
An encoded value was too short to be valid
malformed_value
An encoded value was malformed in some general way
padding_in_tag_number
Unnecessary padding bytes (or bits) in an encoded tag number
tag_number_could_have_used_short_form
Tag number was encoded using the long form when it could have fit in short form. (I believe only applies to X.690 encodings, such as BER, CER, or DER.)
string_constructed_with_invalid_tagging
A constructed string was composed of substituent elements whose tag or tag class did not match.
invalid_construction
An element was expected to be encoded primitively, but it was constructed or vice versa.
unrecognized_components_in_inextensible_type
An unrecognized component was found in an inextensible SET or
SEQUENCE.
unrecognized_alternative_in_inextensible_choice
An unrecognized alternative was found in an inextensible CHOICE
encoding.
prohibited_character(u32, usize)
A prohibited character was found in a string. The first member is the character code point itself, and the second is its index.
construction_too_complex
An encoded constructed value was composed of way too many components and was not decoded as a protection against Denial of Service (DoS).
Duplicate tags were found in a SET type.
duplicate_components
Duplicate components were found in a SET or SEQUENCE. This is a
little different from ASN1ErrorCode::duplicate_tags_in_set in that
this can happen when a component is identified by multiple tags, such as
when it is a CHOICE type without an explicit tag.
missing_required_components
Components that were required in a SET or SEQUENCE (not OPTIONAL
or DEFAULTing) were not found.
int_padding
Padding bits or bytes were found in an integer encoding. In X.690
encodings, the byte 0x00 may not appear at the start of a positive
INTEGER, other than 0, and 0xFF may not appear at the start of a
negative INTEGER.
der_boolean_not_0x00_or_0xFF
A Distinguished Encoding Rules (DER)-encoded BOOLEAN was encoded using
something other than a 0x00 or 0xFF.
oid_padding
Unnecessary padding bytes or bits in an encoded OBJECT IDENTIFIER. In
X.690 encodings, an OBJECT IDENTIFIER arc may not start with the byte
0x80, which is meaningless padding.
unrecognized_special_real
Unrecognized special REAL value not encountered.
bin_real_unrecognized_base
A binary real number used a base value (as in part of the mantissa, base, and exponent that comprise a real number) that was unrecognized.
bin_real_unrecognized_exp_fmt
A binary real number used an exponent format that was unrecognized.
base_10_real_string_malformed(Vec<u8>)
A base-10 REAL string was malformed. The variant value is the bytes
of the string.
base_10_real_unrecognized_format(u8)
Unrecognized REAL string format. The variant value is the identifier
for the format.
base_10_real_unrecognized_base(u8)
A base-10 REAL number used a base value (as in part of the mantissa,
base, and exponent that comprise a real number) that was unrecognized.
x690_long_form_unnecessary
Long-form length was used when it was not necessary.
x690_indefinite_length_but_not_constructed
Indefinite length was indicated, but constructed encoding was not used.
x690_boolean_not_one_byte
X.690 BOOLEAN value not encoded on one byte
x690_bit_string_remainder_gt_7
X.690 BIT STRING had trailing bits greater than 7.
x690_bit_string_remainder_but_no_bits
X.690 BIT STRING had trailing bits indicated, yet no bits
x690_bit_string_zero_bytes
X.690 BIT STRING encoded on zero bytes
x690_bit_string_non_terminal_segment_with_trailing_bits
X.690 constructed BIT STRING had a non-terminal substituent
tag-length-value that had trailing bits.
invalid_year
Invalid year
invalid_month
Invalid month
invalid_day
Invalid day
invalid_hour
Invalid hour
invalid_minute
Invalid minute
invalid_second
Invalid second
invalid_fraction_of_seconds
Invalid fraction of seconds
invalid_time_offset
Invalid time offset
invalid_utf8(Option<Utf8Error>)
Invalid UTF-8 encoding
nonsense
An impossible error that should never happen.
constraint_violation
Constraint violation, such as an INTEGER value of 5 being used where
the type INTEGER (1..3) is expected.
trailing_content_octets
Trailing content octets
invalid_duration_component(char)
Invalid DURATION component
invalid_oid_arc
An OID arc was negative or the first OID arc was not 0, 1, or 2, or the second OID arc was greater than 39 whent he first was 0 or 1.
indefinite_length_prohibited
Indefinite length was used where not allowed, such as in DER.
bit_string_trailing_bits_set
A BIT STRING had trailing bits set, which is not allowed.
real_format_prohibited
A REAL was encoded using a format that is not allowed.
real_base_prohibited
A REAL was encoded using a base that is not allowed.
unrecognized_universal_type
An unrecognized universal type was encountered.
Trait Implementations§
Source§impl Clone for ASN1ErrorCode
impl Clone for ASN1ErrorCode
Source§fn clone(&self) -> ASN1ErrorCode
fn clone(&self) -> ASN1ErrorCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ASN1ErrorCode
impl Debug for ASN1ErrorCode
Source§impl Display for ASN1ErrorCode
impl Display for ASN1ErrorCode
impl Eq for ASN1ErrorCode
Source§impl PartialEq for ASN1ErrorCode
impl PartialEq for ASN1ErrorCode
Source§fn eq(&self, other: &ASN1ErrorCode) -> bool
fn eq(&self, other: &ASN1ErrorCode) -> bool
self and other values to be equal, and is used by ==.