-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QCP-N-QSCD 411 1(411 2), 412-2 and 412 5 #129
base: main
Are you sure you want to change the base?
Changes from all commits
1a2b15e
2931685
91de6f9
cf25115
dd6e770
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,10 @@ | |
from pyasn1.type import univ | ||
from pyasn1_alt_modules import rfc5280, rfc3739 | ||
|
||
import pkilint.etsi.asn1.en_319_411_2 | ||
import pkilint.etsi.en_319_412_3 | ||
from pkilint import validation, oid, document, common | ||
from pkilint.etsi import asn1 as etsi_asn1, etsi_shared | ||
from pkilint.etsi import etsi_constants | ||
from pkilint.etsi import etsi_shared | ||
from pkilint.etsi.asn1 import en_319_411_2 | ||
from pkilint.pkix import extension, name, Rfc2119Word | ||
from pkilint.pkix.general_name import GeneralNameTypeName | ||
|
@@ -463,6 +463,10 @@ class QualifiedCertificatePoliciesValidator(validation.Validator): | |
etsi_constants.QNCP_W_GEN_NP_EIDAS_CERTIFICATE_TYPES, | ||
en_319_411_2.id_qncp_web_gen, | ||
), | ||
( | ||
etsi_constants.QCP_N_QSCD_CERTIFICATE_TYPES, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove or change the TODO comment on line 453 to note that QSCD certs are now supported? |
||
en_319_411_2.id_qcp_natural_qscd, | ||
), | ||
] | ||
|
||
def __init__(self, certificate_type: etsi_constants.CertificateType): | ||
|
@@ -561,3 +565,62 @@ class ExtensionsPresenceValidator(common.ExtensionsPresenceValidator): | |
|
||
def __init__(self): | ||
super().__init__(self.VALIDATION_EXTENSIONS_FIELD_ABSENT) | ||
|
||
|
||
_LEGAL_PERSON_REQUIRED_ATTRIBUTES = { | ||
rfc5280.id_at_countryName, | ||
rfc5280.id_at_organizationName, | ||
rfc5280.id_at_commonName, | ||
} | ||
|
||
|
||
class LegalPersonIssuerAttributeAllowanceValidator( | ||
etsi_shared.LegalPersonAttributeAllowanceValidator | ||
): | ||
_CODE_CLASSIFIER = "etsi.en_319_412_2.gen-4.2.3.1-2" | ||
|
||
def __init__(self): | ||
super().__init__( | ||
self._CODE_CLASSIFIER, | ||
_LEGAL_PERSON_REQUIRED_ATTRIBUTES, | ||
"certificate.tbsCertificate.issuer.rdnSequence", | ||
) | ||
|
||
|
||
class LegalPersonIssuerDuplicateAttributeAllowanceValidator( | ||
etsi_shared.LegalPersonDuplicateAttributeAllowanceValidator | ||
): | ||
VALIDATION_PROHIBITED_DUPLICATE_ATTRIBUTE_PRESENT = validation.ValidationFinding( | ||
validation.ValidationFindingSeverity.ERROR, | ||
"etsi.en_319_412_2.gen-4.2.3.1-5.prohibited_duplicate_attribute_present", | ||
) | ||
|
||
def __init__(self): | ||
super().__init__( | ||
self.VALIDATION_PROHIBITED_DUPLICATE_ATTRIBUTE_PRESENT, | ||
_LEGAL_PERSON_REQUIRED_ATTRIBUTES, | ||
) | ||
|
||
|
||
class LegalPersonIssuerOrganizationAttributesEqualityValidator( | ||
etsi_shared.LegalPersonOrganizationAttributesEqualityValidator | ||
): | ||
VALIDATION_ORGID_ORGNAME_ATTRIBUTE_VALUES_EQUAL = validation.ValidationFinding( | ||
validation.ValidationFindingSeverity.ERROR, | ||
"etsi.en_319_412_2.gen-4.2.3.1-3.organization_id_and_organization_name_attribute_values_equal", | ||
) | ||
|
||
def __init__(self): | ||
super().__init__(self.VALIDATION_ORGID_ORGNAME_ATTRIBUTE_VALUES_EQUAL) | ||
|
||
|
||
class LegalPersonIssuerCountryCodeValidator( | ||
etsi_shared.LegalPersonCountryCodeValidator | ||
): | ||
VALIDATION_UNKNOWN_COUNTRY_CODE = validation.ValidationFinding( | ||
validation.ValidationFindingSeverity.NOTICE, | ||
"etsi.en_319_412_2.gen-4.2.3.1-6.unknown_country_code", | ||
) | ||
|
||
def __init__(self): | ||
super().__init__(self.VALIDATION_UNKNOWN_COUNTRY_CODE) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
from iso3166 import countries_by_alpha2 | ||
from iso4217 import Currency | ||
from urllib.parse import urlparse | ||
from pyasn1_alt_modules import rfc3739 | ||
from pyasn1_alt_modules import rfc3739, rfc5280 | ||
from pkilint.pkix import extension, Rfc2119Word | ||
import iso639 | ||
|
||
|
@@ -160,6 +160,8 @@ def __init__(self, certificate_type): | |
|
||
if certificate_type in etsi_constants.WEB_AUTHENTICATION_CERTIFICATE_TYPES: | ||
self._expected_qc_type = en_319_412_5.id_etsi_qct_web | ||
elif certificate_type in etsi_constants.QCP_N_CERTIFICATE_TYPES: | ||
self._expected_qc_type = en_319_412_5.id_etsi_qct_esign | ||
else: | ||
self._expected_qc_type = None | ||
|
||
|
@@ -307,6 +309,24 @@ def __init__(self): | |
) | ||
|
||
|
||
class QcStatementPresenceValidator(extension.ExtensionPresenceValidator): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this class is needed, as the |
||
""" | ||
QCS-5-01: EU qualified certificates shall include QCStatements in accordance with table 2 | ||
""" | ||
|
||
VALIDATION_QC_STATEMENTS_MISSING = validation.ValidationFinding( | ||
validation.ValidationFindingSeverity.ERROR, | ||
"etsi.en_319_412_5.qcs-5.01", | ||
) | ||
|
||
def __init__(self): | ||
super().__init__( | ||
extension_oid=rfc3739.id_pe_qcStatements, | ||
validation=self.VALIDATION_QC_STATEMENTS_MISSING, | ||
pdu_class=rfc5280.Extensions, | ||
) | ||
|
||
|
||
class QcStatementIdentifierAllowanceValidator( | ||
common.ElementIdentifierAllowanceValidator | ||
): | ||
|
@@ -332,17 +352,28 @@ def retrieve_qualified_statement_id(cls, node): | |
def __init__(self, certificate_type: etsi_constants.CertificateType): | ||
allowances = {} | ||
|
||
if certificate_type in etsi_constants.EU_QWAC_TYPES: | ||
if certificate_type in etsi_constants.EU: | ||
# Table 2: 4.2.1 | ||
allowances[en_319_412_5.id_etsi_qcs_QcCompliance] = Rfc2119Word.MUST | ||
# Table 2: 4.2.4 | ||
allowances[en_319_412_5.id_etsi_qcs_QcCClegislation] = Rfc2119Word.MUST_NOT | ||
allowances[en_319_412_5.id_etsi_qcs_QcType] = Rfc2119Word.MUST | ||
# Table 2: 4.2.2 | ||
if certificate_type in etsi_constants.EU_SSCD: | ||
allowances[en_319_412_5.id_etsi_qcs_QcSSCD] = Rfc2119Word.MUST | ||
|
||
if (certificate_type in etsi_constants.EU_QWAC_TYPES) or ( | ||
certificate_type in etsi_constants.QCP_N_CERTIFICATE_TYPES | ||
): | ||
# Table 2: 4.2.3 (QWAC is Annex IV, signatures is Annex I) | ||
allowances[en_319_412_5.id_etsi_qcs_QcType] = Rfc2119Word.MUST | ||
if certificate_type in etsi_constants.EU_QWAC_TYPES: | ||
# PR Question: Table 2, 4.2.2 only defines MUST, is the MUST_NOT also from 412-5 somewhere? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this comment can be removed since the conversation is resolved. |
||
allowances[en_319_412_5.id_etsi_qcs_QcSSCD] = Rfc2119Word.MUST_NOT | ||
breynders-cb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
elif certificate_type in etsi_constants.NON_EU_QWAC_TYPES: | ||
allowances[en_319_412_5.id_etsi_qcs_QcCompliance] = Rfc2119Word.MUST | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this line needs to be restored. See EN 319 412 5, clause 4.2.1:
|
||
# PR Question: Is this from 415_5.qcs-4.2? Needs different classifier? | ||
allowances[en_319_412_5.id_etsi_qcs_QcCClegislation] = Rfc2119Word.MUST | ||
Comment on lines
+374
to
375
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering what the source was for this rule. I couldn't really find it other than the reference in 412-5 QCS 4.2. If so, would it need a different source in the validation finding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See table 1A in EN 319 412 5, clause 4.2.1. The CCLegislation statement is needed for certs that are qualified but not in the EU. |
||
|
||
if certificate_type in etsi_constants.QWAC_TYPES: | ||
allowances[en_319_412_5.id_etsi_qcs_QcSSCD] = Rfc2119Word.MUST_NOT | ||
|
||
super().__init__( | ||
"qualified statement", | ||
self.retrieve_qualified_statement_id, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this
if
statement can be removed, as the issuer requirements are applicable for non-EU certs as well.