CertificationRequestInfo Attributes should not be optional
See original GitHub issueCurrently, within the csr.py module CertificationRequestInfo is defined as:
class CertificationRequestInfo(Sequence):
_fields = [
('version', Version),
('subject', Name),
('subject_pk_info', PublicKeyInfo),
('attributes', CRIAttributes, {'implicit': 0, 'optional': True}),
]
However, there is no mention in RFC 2986 of the attributes field being optional (as shown above). Also, OpenSSL’s req has the following to say about it within it’s man pages under the -asn1-kludge option:
More precisely the Attributes in a PKCS#10 certificate request are defined as a SET OF Attribute. They are not OPTIONAL so if no attributes are present then they should be encoded as an empty SET OF. The invalid form does not include the empty SET OF whereas the correct form does.
I currently cannot create a CertificationRequestInfo with an empty SET OF attributes. That is, I either have to leave it out (non-compliant) or add at least one attribute (which I don’t need).
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)

Top Related StackOverflow Question
This works:
To further clarify:
Should read: “As far as I recall, it isn’t used to validate that a field has been set when dumping.”