Skip to content

Conversation

ghm12
Copy link
Contributor

@ghm12 ghm12 commented Feb 9, 2023

Currently, when creating a Certificate which has the Certificate Policies extension but the included policy has no Policy Qualifier, the certificate is issued with an empty qualifiers sequence. According to RFC 5280 the policyQualifiers is an optional field, however if it exists it must be greater than zero, and thus the empty sequence would make the Certificate format invalid.

   PolicyInformation ::= SEQUENCE {
        policyIdentifier   CertPolicyId,
        policyQualifiers   SEQUENCE SIZE (1..MAX) OF
                                PolicyQualifierInfo OPTIONAL } 

To fix this, before creating the policyQualifiers sequence, first it checks if said Policy has any qualifiers and only creates the sequence if it does.

@ghm12 ghm12 closed this Feb 9, 2023
@ghm12 ghm12 reopened this Feb 9, 2023
@lucas-mayr lucas-mayr merged commit 5cd2546 into LabSEC:master Feb 13, 2023
ghm12 added a commit to ghm12/libcryptosec that referenced this pull request Apr 20, 2023
Fix creation of empty sequence on CertificatePolicies Extension
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