Repository navigation
x509-cert: fix UserNotice::notice_ref type, add DisplayText::BmpString - #2569
Draft
MarkAtwood wants to merge 1 commit into
Draft
MarkAtwood wants to merge 1 commit into
MarkAtwood wants to merge 1 commit into
Conversation
…ring`
`UserNotice::notice_ref` was declared `Option<GeneralizedTime>`. RFC 5280
Section 4.2.1.4 gives it as `NoticeReference`:
UserNotice ::= SEQUENCE {
noticeRef NoticeReference OPTIONAL,
explicitText DisplayText OPTIONAL }
NoticeReference ::= SEQUENCE {
organization DisplayText,
noticeNumbers SEQUENCE OF INTEGER }
`NoticeReference` is already defined correctly in this module and was
never used, so a `UserNotice` carrying a `noticeRef` could not be
decoded.
`DisplayText` implemented two of the CHOICE's four alternatives. This
adds `bmpString`, which `der::asn1::BmpString` can hold. `visibleString`
is still missing: `der` has `Tag::VisibleString` but no `asn1` type for
the value, and adding one is a public API decision for that crate.
Neither type had any test, which is how both survived. Three are added:
a `UserNotice` with a `noticeRef`, one with a `bmpString` explicitText,
and one covering the two alternatives that already worked, each
round-tripping through `from_der` and `to_der`.
Both changes are breaking: `DisplayText` and `UserNotice` are not
`#[non_exhaustive]`, so adding a variant and changing a field type are
each visible to downstream exhaustive matches and struct literals.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UserNotice::notice_refis declaredOption<GeneralizedTime>.RFC 5280 §4.2.1.4
gives it as
NoticeReference:NoticeReferenceis defined in the same module and unused. AUserNoticecarrying anoticeRefdoes not decode.DisplayTextimplements two of four alternatives:This changes
notice_reftoOption<NoticeReference>and addsDisplayText::BmpString, held byder::asn1::BmpString.Three tests,
from_derandto_derin each: aUserNoticewith anoticeRef, one with abmpStringexplicitText, and one for the twoalternatives already implemented.
visibleStringNot added; tracked in #2570.
RFC 6818
RFC 6818 §3 replaced
§4.2.1.4's tenth paragraph:
utf8Stringia5StringvisibleStringbmpStringThe two alternatives currently implemented are the preferred one and the
prohibited one.
Breaking
DisplayTextandUserNoticeare not#[non_exhaustive]. A new variantand a changed field type are both visible to downstream exhaustive
matches and struct literals. Draft in case these belong on a 0.4 line, or
want
#[non_exhaustive]in the same change.Checks
cargo test -p x509-cert,--no-default-features,cargo fmt,cargo clippy: clean.--all-featureshas five failures in the buildertests, which shell out to a
zlintbinary absent here; identical onclean
master.cargo hackfeature-powerset not run.