pub enum DecodeError {
Show 27 variants
Malformed,
NotTagged,
WrongTag {
expected: u64,
actual: u64,
},
IndefiniteLength,
NonMinimalEncoding,
NonDeterministicEncoding,
DuplicateLabel,
UnknownLabel {
label: i64,
},
TextLabel,
WrongType {
label: i64,
},
MissingHeader {
label: i64,
},
UnknownAlgorithm {
alg: i64,
},
CritMissing,
CritIncomplete {
label: i64,
},
CritUnexpected {
label: i64,
},
ClaimsInUnprotected,
UnknownClaim {
claim: i64,
},
FractionalTime,
MissingClaim {
claim: i64,
},
RecipientCount {
count: usize,
},
NestedRecipients,
RecipientCiphertextPresent,
MissingPayload,
EmbeddedNotEncrypt,
EphemeralKeyShape,
InvalidLength {
label: i64,
expected: usize,
actual: usize,
},
Identifier(ProfileError),
}Expand description
Strict-decode rejection reasons.
The strict decoder rejects anything outside the profile: wrong or missing tags, indefinite lengths, non-deterministic encodings (RFC 8949 §4.2), duplicate or unknown labels, claims in unprotected headers, unknown codepoints, and malformed structure shapes.
Variants§
Malformed
The input is not well-formed CBOR (truncated, trailing garbage, or a structurally invalid item).
NotTagged
The top-level item is not tagged.
WrongTag
The top-level tag is not the expected COSE tag.
Fields
IndefiniteLength
An indefinite-length item was encountered (forbidden by RFC 8949 §4.2).
NonMinimalEncoding
An integer/length header was not minimally encoded (RFC 8949 §4.2).
NonDeterministicEncoding
Re-encoding the decoded message did not reproduce the input bytes: the encoding is not the profile’s deterministic encoding.
DuplicateLabel
A map carried the same label twice.
UnknownLabel
A label appeared somewhere the profile does not allow it.
TextLabel
A text label was used; the profile is integer-labelled throughout.
WrongType
A known label carried the wrong CBOR type.
MissingHeader
A required header parameter is absent.
UnknownAlgorithm
An algorithm codepoint outside the profile allow-set.
CritMissing
The crit header is absent on a layer that requires it.
CritIncomplete
A profile label is present but not listed in crit.
CritUnexpected
crit lists a label the profile does not place on this layer.
ClaimsInUnprotected
A claim was found in an unprotected header.
UnknownClaim
An unknown key appeared inside the CWT claims map.
FractionalTime
A CWT timestamp was fractional; the profile requires whole seconds.
MissingClaim
A required CWT claim is absent (iat = 6, cti = 7).
RecipientCount
The recipients array length is not exactly one.
NestedRecipients
The recipient structure carries nested recipients.
RecipientCiphertextPresent
The recipient ciphertext is not nil; ECDH-ES direct key agreement
carries no recipient ciphertext.
MissingPayload
The signed payload is absent (nil); detached payloads are not part
of this profile.
EmbeddedNotEncrypt
A sealed message’s payload is not a tagged COSE_Encrypt.
EphemeralKeyShape
The ephemeral key is not an OKP/X25519 public key of the exact profile shape.
InvalidLength
A fixed-length field (ephemeral key, nonce, request hash) had the wrong length.
Fields
Identifier(ProfileError)
An identifier failed its newtype validation while decoding.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
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 DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<DecodeError> for VerifyError
impl From<DecodeError> for VerifyError
Source§fn from(e: DecodeError) -> Self
fn from(e: DecodeError) -> Self
Source§impl From<DecodeError> for OpenError
impl From<DecodeError> for OpenError
Source§fn from(e: DecodeError) -> Self
fn from(e: DecodeError) -> Self
Source§impl From<ProfileError> for DecodeError
impl From<ProfileError> for DecodeError
Source§fn from(e: ProfileError) -> Self
fn from(e: ProfileError) -> Self
Source§impl PartialEq for DecodeError
impl PartialEq for DecodeError
Source§fn eq(&self, other: &DecodeError) -> bool
fn eq(&self, other: &DecodeError) -> bool
self and other values to be equal, and is used by ==.