// This file is part of the happyDomain (R) project.
// Copyright (c) 2022-2025 happyDomain
// Authors: Pierre-Olivier Mercier, et al.
//
// This program is offered under a commercial and under the AGPL license.
// For commercial licensing, contact us at <contact@happydomain.org>.
//
// For AGPL licensing:
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

export const issuers: Record<string, Array<string>> = {
    "Actalis S.p.A.": ["actalis.it"],
    "Amazon Trust Services LLC": [
        "amazon.com",
        "amazontrust.com",
        "awstrust.com",
        "amazonaws.com",
        "aws.amazon.com",
    ],
    "ANF AC": ["anf.es"],
    "Asseco Data Systems (formely Certum)": ["certum.pl", "certum.eu"],
    Apple: ["pki.apple.com"],
    Atos: ["atos.net"],
    "Beijing CA": ["bjca.cn"],
    "Buypass AS": ["buypass.com", "buypass.no"],
    CAcert: ["cacert.org"],
    "AC Camerfirma S.A.": ["camerfirma.com"],
    CATCert: ["aoc.cat"],
    "Fastly/Certainly": ["certainly.com"],
    Certinomis: ["www.certinomis.com", "www.certinomis.fr"],
    Dhimyotis: ["certigna.fr"],
    Certizen: ["ecert.gov.hk", "hongkongpost.gov.hk"],
    certSIGN: ["certsign.ro"],
    "China Financial CA (CFCA)": ["cfca.com.cn"],
    "China Internet Network Information Center (CNNIC)": ["cnnic.cn"],
    "Chunghwa Telecom": [
        "pki.hinet.net",
        "tls.hinet.net",
        "eca.hinet.net",
        "epki.com.tw",
        "publicca.hinet.net",
    ],
    "ComSign Ltd": ["comsign.co.il", "comsign.co.uk", "comsigneurope.com"],
    "Cybertrust Japan": ["cybertrust.ne.jp", "jcsinc.co.jp"],
    "Deutsche Telekom Security": ["telesec.de"],
    "DFN-PKI": ["pki.dfn.de", "dfn.de"],
    DigiCert: [
        "digicert.com",
        "symantec.com",
        "geotrust.com",
        "rapidssl.com",
        "thawte.com",
        "digitalcertvalidation.com",
        "volusion.digitalcertvalidation.com",
        "stratossl.digitalcertvalidation.com",
        "intermediatecertificate.digitalcertvalidation.com",
        "1and1.digitalcertvalidation.com",
    ],
    "DigitalSign CD": ["digitalsign.pt"],
    "Disig, a.s.": ["disig.sk"],
    DocuSign: ["docusign.fr"],
    "D-Trust GmbH": ["dtrust.de", "d-trust.de", "dtrust.net", "d-trust.net"],
    DigitalTrust: ["digitaltrust.ae"],
    EDICOM: ["edicomgroup.com"],
    "eMudhra Technologies Limited": ["emsign.com"],
    Entrust: ["entrust.net", "affirmtrust.com"],
    "E-TUGRA Inc.": ["e-tugra.com", "e-tugra.com.tr", "etugra.com", "etugra.com.tr"],
    "AC Firmaprofesional CIF": ["firmaprofesional.com"],
    "Guang Dong CA Co.": ["gdca.com.cn"],
    GlobalSign: ["globalsign.com"],
    "Global Trust": ["globaltrust.eu"],
    "GoDaddy Inc.": ["godaddy.com", "starfieldtech.com"],
    "Google Trust Services (GTS)": ["pki.goog", "google.com"],
    "ACCV (Spain gov)": ["accv.es"],
    "FNMT (Spain gov)": ["fnmt.es"],
    "Agence Nationale de Certification Electronique (Tunisia gov)": ["tuntrust.tn"],
    GRCA: ["gca.nat.gov.tw"],
    HARICA: ["harica.gr"],
    "Hongkong Post": ["ecert.gov.hk", "hongkongpost.gov.hk"],
    IdenTrust: ["identrust.com", "www.identrust.com"],
    "iTrusChina Co.": ["itrus.com.cn", "itrus.cn"],
    "IZENPE S.A.": ["izenpe.com", "izenpe.eus"],
    "Japan Registry Services": ["jprs.co.jp"],
    "Kamu Sertifikasyon Merkezi": ["kamusm.gov.tr"],
    "KPN Corporate Market BV": ["kpn.com"],
    "Krajowa Izba Rozliczeniowa S.A. (KIR)": ["elektronicznypodpis.pl"],
    LAWtrust: ["lawtrust.co.za"],
    "Let's Encrypt": ["letsencrypt.org"],
    "Logius PKIoverheid": ["logius.nl"],
    "Microsec Ltd.": ["e-szigno.hu"],
    Microsoft: ["microsoft.com"],
    "Microsoft IT": ["ssladmin.microsoft.com"],
    "MSC Trustgate": ["msctrustgate.com"],
    "National Center for Digital Certification (NCDC)": ["ncdc.gov.sa"],
    "NAVER Business Platform Corp.": ["certificate.naver.com"],
    "NetLock Kft.": ["netlock.hu", "netlock.net", "netlock.eu"],
    Networking4all: ["trustproviderbv.digitalcertvalidation.com"],
    "Network Solutions LLC": ["networksolutions.com", "web.com"],
    "OISTE Foundation": ["wisekey.com", "hightrusted.com", "certifyid.com", "oiste.org"],
    "Open Access Technology International": ["oati.com"],
    "Prvni certifikacni autorita, a.s.": ["ica.cz"],
    PKIoverheid: ["www.pkioverheid.nl"],
    QuoVadis: [
        "quovadisglobal.com",
        "digicert.com",
        "digicert.ne.jp",
        "cybertrust.ne.jp",
        "symantec.com",
        "thawte.com",
        "geotrust.com",
        "rapidssl.com",
        "digitalcertvalidation.com",
    ],
    "SECOM Trust Systems": ["secomtrust.net"],
    Sectigo: ["sectigo.com", "comodo.com", "comodoca.com", "usertrust.com", "trust-provider.com"],
    "Shanghai Electronic Certification Authority Co. Ltd": [
        "sheca.com",
        "imtrust.cn",
        "wwwtrust.cn",
    ],
    "SK ID Solutions AS": ["skidsolutions.eu"],
    "SSL Corporation": ["ssl.com"],
    "Skaitmeninio sertifikavimo centras (SSC)": ["ssc.lt"],
    "SwissSign AG": [
        "swisssign.com",
        "swisssign.net",
        "swissign.com",
        "swisssign.ch",
        "swisssign.li",
        "swissign.li",
        "swisssign.org",
        "swisssign.biz",
        "swisstsa.ch",
        "swisstsa.li",
        "digitalid.ch",
        "digital-id.ch",
        "zert.ch",
        "rootsigning.com",
        "root-signing.ch",
        "ssl-certificate.ch",
        "managed-pki.ch",
        "managed-pki.de",
        "swissstick.com",
        "swisssigner.ch",
        "pki-posta.ch",
        "pki-poste.ch",
        "pki-post.ch",
        "trustdoc.ch",
        "trustsign.ch",
        "swisssigner.com",
        "postsuisseid.ch",
        "suisseid-service.ch",
        "signdemo.com",
        "sirb.com",
    ],
    "SecureTrust Corporation": ["trustwave.com", "securetrust.com"],
    "TAIWAN-CA Inc. (TWCA)": ["twca.com.tw"],
    "Telia Finland Oyj": ["telia.com", "telia.fi", "telia.se"],
    "TrustCor Systems": ["trustcor.ca"],
    "T-Systems Enterprise Services": ["t-systems.com"],
    Visa: ["visa.com"],
    Zertificon: ["zertificon.com"],
    "360": ["browser.360.cn"],
};

export const rev_issuers: Record<string, string> = {};

for (const issuer in issuers) {
    for (const dn of issuers[issuer]) {
        rev_issuers[dn] = issuer;
    }
}

export default issuers;
