summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-07-22 06:56:08 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-07-22 06:56:08 +0300
commit43cce1b10901bff92d5bd52595ef3b7b4e65ee80 (patch)
tree662de1b995490b9569683ddaadc9c001468b414c /src
parentbe456258d7160a110e8ea13cd0a17db1513224ff (diff)
Generated certificates should be self-issued
RFC 5280 defines a self-signed CA certificate as also being self-issued, so to honor this definition we set the issuer and the subject to be fully equivalent. IssueID #316
Diffstat (limited to 'src')
-rw-r--r--src/gmcerts.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gmcerts.c b/src/gmcerts.c
index d8e77b12..2c7b1122 100644
--- a/src/gmcerts.c
+++ b/src/gmcerts.c
@@ -589,8 +589,15 @@ static iGmIdentity *add_GmCerts_(iGmCerts *d, iTlsCertificate *cert, int flags)
589iGmIdentity *newIdentity_GmCerts(iGmCerts *d, int flags, iDate validUntil, const iString *commonName, 589iGmIdentity *newIdentity_GmCerts(iGmCerts *d, int flags, iDate validUntil, const iString *commonName,
590 const iString *email, const iString *userId, const iString *domain, 590 const iString *email, const iString *userId, const iString *domain,
591 const iString *org, const iString *country) { 591 const iString *org, const iString *country) {
592 /* Note: RFC 5280 defines a self-signed CA certificate as also being self-issued, so
593 to honor this definition we set the issuer and the subject to be fully equivalent. */
592 const iTlsCertificateName names[] = { 594 const iTlsCertificateName names[] = {
593 { issuerCommonName_TlsCertificateNameType, commonName }, 595 { issuerCommonName_TlsCertificateNameType, commonName },
596 { issuerEmailAddress_TlsCertificateNameType, !isEmpty_String(email) ? email : NULL },
597 { issuerUserId_TlsCertificateNameType, !isEmpty_String(userId) ? userId : NULL },
598 { issuerDomain_TlsCertificateNameType, !isEmpty_String(domain) ? domain : NULL },
599 { issuerOrganization_TlsCertificateNameType, !isEmpty_String(org) ? org : NULL },
600 { issuerCountry_TlsCertificateNameType, !isEmpty_String(country) ? country : NULL },
594 { subjectCommonName_TlsCertificateNameType, commonName }, 601 { subjectCommonName_TlsCertificateNameType, commonName },
595 { subjectEmailAddress_TlsCertificateNameType, !isEmpty_String(email) ? email : NULL }, 602 { subjectEmailAddress_TlsCertificateNameType, !isEmpty_String(email) ? email : NULL },
596 { subjectUserId_TlsCertificateNameType, !isEmpty_String(userId) ? userId : NULL }, 603 { subjectUserId_TlsCertificateNameType, !isEmpty_String(userId) ? userId : NULL },