-
Notifications
You must be signed in to change notification settings - Fork 29
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
DER Serialization Problem #249
Comments
Hi!
I think this is normal, because the directory name variant is defined as implicitly tagged. We know that it’s implicitly tagged by looking at the title of the module:
And this line:
More on this: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/#explicit-vs-implicit
About this, on the other hand, we do have a long-standing issue: But this has been mitigated: In this case, I believe this should be a context-specific tag (
The certificate for github.com is using a context-specific tag as expected:
For All that said, I’ve sometimes seen application tags used instead of context tags and vice versa. |
Hi @CBenoit! Thanks for the reply and sorry for the delay! I'm still trying to figure out this puzzle.
Is this the case because, even though we see
How do you understand that?
That would also make sense if we assume that I'm still trying to understand why The Rust code I wrote is mainly this: let der = picky_asn1_der::to_vec(&GeneralNames::from(vec![GeneralName::DirectoryName(Name(
RdnSequence::from(vec![RelativeDistinguishedName::from(vec![
AttributeTypeAndValue::new_common_name("TEST"),
])]),
))])).unwrap(); resulting in the DER bytes
However, if I do a hack adding a let mut der =
picky_asn1_der::to_vec(&vec![vec![vec![RelativeDistinguishedName::from(vec![
AttributeTypeAndValue::new_common_name("TEST"),
])]]]).unwrap();
der[2] = 0xa4; resulting in the DER bytes
[1] https://www.itu.int/ITU-T/studygroups/com10/languages/X.680_1297.pdf |
Hi all,
I noticed two potential problems when serializing a custom SAN containing a directory name using the
picky_asn1_der
crate.Please, read them below.
Potential Problem 1
According to RFC 5280, the SAN should follow:
and:
But when implementing it in Rust, the sequence tag for
RDNSequence
disappears. Please, see the code snippet below.The output is:
where
300f
disappeared from the serialized value. Did I miss anything?Potential Problem 2
Another question, as I'm constructing the SAN, shouldn't the tag for
Name
be0xa4
instead of0x84
in the output above?If I try to visualize the SAN content with tag
0x84
using the openssl CLI, it dumps binary, but with tag0xa4
it parses the DER content as expected.The text was updated successfully, but these errors were encountered: