Skip to content

Commit 116ce15

Browse files
authored
docs: add Tagged comments ISO/IEC 8825-1:2021 in CustomClasses
1 parent fd9b041 commit 116ce15

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

der/src/asn1/custom_class.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ where
164164

165165
impl<const TAG: u16, T, const CLASS: u8> Tagged for CustomClassExplicit<TAG, T, CLASS> {
166166
fn tag(&self) -> Tag {
167-
expected_tag_constructed(Class::from(CLASS), TagNumber(TAG), true)
167+
// ISO/IEC 8825-1:2021
168+
// 8.14.3 If implicit tagging (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 31.2.7) was not used in the definition of the type, the
169+
// encoding shall be constructed and the contents octets shall be the complete base encoding [Encode].
170+
let constructed = true;
171+
expected_tag_constructed(Class::from(CLASS), TagNumber(TAG), constructed)
168172
}
169173
}
170174

@@ -173,6 +177,10 @@ where
173177
T: FixedTag,
174178
{
175179
fn tag(&self) -> Tag {
180+
// ISO/IEC 8825-1:2021
181+
// 8.14.4 If implicit tagging was used in the definition of the type, then:
182+
// a) the encoding shall be constructed if the base encoding is constructed, and shall be primitive otherwise; and
183+
// b) the contents octets shall be the same as the contents octets [EncodeValue] of the base encoding.
176184
let constructed = <T as FixedTag>::TAG.is_constructed();
177185
expected_tag_constructed(Class::from(CLASS), TagNumber(TAG), constructed)
178186
}

0 commit comments

Comments
 (0)