#[non_exhaustive]pub enum Tag {
Show 20 variants
Boolean,
Integer,
BitString,
OctetString,
Null,
ObjectIdentifier,
Enumerated,
Utf8String,
Sequence,
Set,
NumericString,
PrintableString,
Ia5String,
UtcTime,
GeneralizedTime,
VisibleString,
BmpString,
Application {
constructed: bool,
number: TagNumber,
},
ContextSpecific {
constructed: bool,
number: TagNumber,
},
Private {
constructed: bool,
number: TagNumber,
},
}
Expand description
ASN.1 tags.
Tags are the leading identifier octet of the Tag-Length-Value encoding used by ASN.1 DER and identify the type of the subsequent value.
They are described in X.690 Section 8.1.2: Identifier octets, and structured as follows:
| Class | P/C | Tag Number |
- Bits 8/7:
Class
- Bit 6: primitive (0) or constructed (1)
- Bits 5-1: tag number
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Boolean
BOOLEAN
tag: 1
.
Integer
INTEGER
tag: 2
.
BitString
BIT STRING
tag: 3
.
OctetString
OCTET STRING
tag: 4
.
Null
NULL
tag: 5
.
ObjectIdentifier
OBJECT IDENTIFIER
tag: 6
.
Enumerated
ENUMERATED
tag: 10
.
Utf8String
UTF8String
tag: 12
.
Sequence
SEQUENCE
tag: 16
.
Set
SET
and SET OF
tag: 17
.
NumericString
NumericString
tag: 18
.
PrintableString
PrintableString
tag: 19
.
Ia5String
IA5String
tag: 22
.
UtcTime
UTCTime
tag: 23
.
GeneralizedTime
GeneralizedTime
tag: 24
.
VisibleString
VisibleString
tag: 26
.
BmpString
BMPString
tag: 30
.
Application
Application tag.
ContextSpecific
Context-specific tag.
Private
Private tag number.
Implementations§
source§impl Tag
impl Tag
sourcepub fn assert_eq(self, expected: Tag) -> Result<Tag>
pub fn assert_eq(self, expected: Tag) -> Result<Tag>
Assert that this Tag
matches the provided expected tag.
On mismatch, returns an Error
with ErrorKind::TagUnexpected
.
sourcepub fn is_constructed(self) -> bool
pub fn is_constructed(self) -> bool
Does this tag represent a constructed (as opposed to primitive) field?
sourcepub fn is_application(self) -> bool
pub fn is_application(self) -> bool
Is this an application tag?
sourcepub fn is_context_specific(self) -> bool
pub fn is_context_specific(self) -> bool
Is this a context-specific tag?
sourcepub fn is_private(self) -> bool
pub fn is_private(self) -> bool
Is this a private tag?
sourcepub fn is_universal(self) -> bool
pub fn is_universal(self) -> bool
Is this a universal tag?
sourcepub fn length_error(self) -> Error
pub fn length_error(self) -> Error
sourcepub fn non_canonical_error(self) -> Error
pub fn non_canonical_error(self) -> Error
Create an Error
for an non-canonical value with the ASN.1 type
identified by this tag.
sourcepub fn unexpected_error(self, expected: Option<Self>) -> Error
pub fn unexpected_error(self, expected: Option<Self>) -> Error
Create an Error
because the current tag was unexpected, with an
optional expected tag.
sourcepub fn value_error(self) -> Error
pub fn value_error(self) -> Error
Create an Error
for an invalid value with the ASN.1 type identified
by this tag.
Trait Implementations§
source§impl Encodable for Tag
impl Encodable for Tag
source§impl Ord for Tag
impl Ord for Tag
source§impl PartialOrd for Tag
impl PartialOrd for Tag
impl Copy for Tag
impl Eq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)