Skip to content

der: BER decoding support: add constructed octet string #1821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions der/src/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ mod number;

pub use self::{class::Class, mode::TagMode, number::TagNumber};

use crate::{Decode, DerOrd, Encode, Error, ErrorKind, Length, Reader, Result, Writer};
use crate::{
Decode, DerOrd, Encode, EncodingRules, Error, ErrorKind, Length, Reader, Result, Writer,
};
use core::{cmp::Ordering, fmt};

/// Indicator bit for constructed form encoding (i.e. vs primitive form)
Expand Down Expand Up @@ -91,10 +93,10 @@ pub enum Tag {
/// `UTF8String` tag: `12`.
Utf8String,

/// `SEQUENCE` tag: `16`.
/// `SEQUENCE` tag: `16` (constructed).
Sequence,

/// `SET` and `SET OF` tag: `17`.
/// `SET` and `SET OF` tag: `17` (constructed).
Set,

/// `NumericString` tag: `18`.
Expand Down Expand Up @@ -343,6 +345,7 @@ impl<'a> Decode<'a> for Tag {
0x1A => Tag::VisibleString,
0x1B => Tag::GeneralString,
0x1E => Tag::BmpString,
0x24 if reader.encoding_rules() == EncodingRules::Ber => Tag::OctetString, // constructed
0x30 => Tag::Sequence, // constructed
0x31 => Tag::Set, // constructed
0x40..=0x7F => {
Expand Down