question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CertificationRequestInfo Attributes should not be optional

See original GitHub issue

Currently, 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:open
  • Created 3 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
joernheisslercommented, Aug 13, 2020

This works:

cri['attributes'] = csr.CRIAttributes([])
0reactions
wbondcommented, Aug 13, 2020

To further clarify:

As far as I recall, it isn’t used to validate that a field has been set.

Should read: “As far as I recall, it isn’t used to validate that a field has been set when dumping.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

bc-java/CertificationRequestInfo.java at master - GitHub
the attributes field is not optional so should always at least contain an empty set. If a fully compliant. * request is required,...
Read more >
org.spongycastle.asn1.pkcs.CertificationRequestInfo ... - Tabnine
<p> * Note: Early on a lot of CAs would only accept messages with attributes missing. As the ASN.1 def shows * the...
Read more >
CertificationRequestInfo (Bouncy Castle Library 1.64 API ...
As the ASN.1 def shows the attributes field is not optional so should always at least contain an empty set. If a fully...
Read more >
Build your Farm Island Empire and sell to earn - Javadox
X509Name; /** * PKCS10 CertificationRequestInfo object. ... As the ASN.1 def shows * the attributes field is not optional so should always at...
Read more >
RFC 2985 - PKCS #9: Selected Object Classes and Attribute ...
It does not specify an Internet standard of any kind. ... RFC 2985 Selected Object Classes and Attribute Types November 2000 CertificationRequestInfo An ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found