Skip to content

Conversation

@carl-wallace
Copy link
Contributor

add just enough CMS support to allow incoming path builder implementation to parse certs-only SignedData messages. The inclusion of SetOf caused several structs to need Ord and/or PartialOrd added.

… definitions to work around macro-related issues. Notes on non-use of macros

In trust_anchor_format.rs
- Choice was not used on TrustAnchorChoice owing to types not available in Asn1Type enum
- Sequence was not used on TrustAnchorInfo owing to lack of DecodeValue required by context_specific

error[E0277]: the trait bound `TrustAnchorInfo<'a>: DecodeValue<'_>` is not satisfied
   --> x509/src/trust_anchor_format.rs:295:22
    |
295 |                     .context_specific::<TrustAnchorInfo<'a>>(TAC_TA_INFO_TAG, TagMode::Explicit)?;
    |                      ^^^^^^^^^^^^^^^^ the trait `DecodeValue<'_>` is not implemented for `TrustAnchorInfo<'a>`
    |
note: required by a bound in `Decoder::<'a>::context_specific`
   --> der/src/decoder.rs:172:12
    |
172 |         T: DecodeValue<'a> + FixedTag,
    |            ^^^^^^^^^^^^^^^ required by this bound in `Decoder::<'a>::context_specific`

- Sequence was not used on CertPathControls to use decode_implicit for each field (trailing bits were left using the default decoder even with mods to Certificate and NameConstraints)

In certificate.rs
- Sequence was not used on Certificate due to same issue as described above for TrustAnchorInfo (i.e., tension between use of DecodeValue and Decodable)
- Sequence was not used on NameConstraints for the same DecodeValue vs Decodable issue.
…tion to parse certs-only SignedData messages. The inclusion of SetOf<SignerInfo> caused several structs to need Ord and/or PartialOrd added.
@tarcieri
Copy link
Member

A general note: the DerOrd and ValueOrd traits are needed for SetOf ordering now. The Ord trait does not necessarily reflect the ordering when serialized as DER.

ValueOrd can be derived.

///
/// [RFC 5280 Section 4.1.1.2]: https://tools.ietf.org/html/rfc5280#section-4.1.1.2
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type already impls ValueOrd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped Ord and PartialOrd from AlgorithmIdentifier and SignerInfo. Stubbed out ValueOrd for SignerInfo (not needed now and CMS is well short of complete at present).

…ed out ValueOrd for SignerInfo (not needed for dealing with certs-only SignedData structures)
@carl-wallace
Copy link
Contributor Author

Close pending refactoring to account for recent changes.

@carl-wallace carl-wallace deleted the PartialSignedDataImpl branch March 21, 2022 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants