Skip to content

Commit ab9a848

Browse files
authored
x509-cert: Serial numbers are formated as printable string (#794)
1 parent 4e97ab3 commit ab9a848

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

x509-cert/src/attr.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Attribute-related definitions as defined in X.501 (and updated by RFC 5280).
22
33
use alloc::vec::Vec;
4-
use const_oid::db::rfc4519::{COUNTRY_NAME, DOMAIN_COMPONENT};
4+
use const_oid::db::rfc4519::{COUNTRY_NAME, DOMAIN_COMPONENT, SERIAL_NUMBER};
55
use core::fmt::{self, Write};
66

77
use const_oid::db::DB;
@@ -185,6 +185,9 @@ impl AttributeTypeAndValue<'_> {
185185
let tag = match oid {
186186
COUNTRY_NAME => Tag::PrintableString,
187187
DOMAIN_COMPONENT => Tag::Ia5String,
188+
// Serial numbers are formated as Printable String as per RFC 5280 Appendix A.1:
189+
// https://datatracker.ietf.org/doc/html/rfc5280#appendix-A.1
190+
SERIAL_NUMBER => Tag::PrintableString,
188191
_ => Tag::Utf8String,
189192
};
190193

0 commit comments

Comments
 (0)