-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers
Description
If you issue a certificate with non-matching hostname and common_name values, you cannot use load_certificate() to fetch the certificate for later use. You end up with one of the following errors:
Using the hostname as the argument value:
ownca.exceptions.OwnCAInconsistentData: Initialized CN name does not match with current existent common_name: <hostname>
Using the CN as the argument value:
ownca.exceptions.OwnCAInvalidCertificate: The certificate does not exist for 'example.com'.
Example code that will reproduce the issue:
from ownca import CertificateAuthority
from ownca.exceptions import OwnCAInconsistentData, OwnCAInvalidCertificate
CA_CERT_DIR = <enter your own for testing>
ca = CertificateAuthority(ca_storage=CA_CERT_DIR, common_name="ownca")
serverCert = ca.issue_certificate(hostname="frontend",
maximum_days=825,
common_name="example.com",
dns_names=[],
oids=certOids,
public_exponent=65537,
key_size=2048)
print("-- load_certificate(<hostname>) --")
try:
sameCert = ca.load_certificate("frontend")
except OwnCAInconsistentData as e:
print(e)
print("-- load_certificate(<common_name>) --")
try:
sameCert = ca.load_certificate("example.com")
except OwnCAInvalidCertificate as e:
print(e)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers