Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

C Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(C) Load CA Cert Bundle into Trusted Roots

Demonstrates how to load a PEM file containing CA root certificates that are to be trusted by the application. This can be done once at the beginning of an application, and then the trusted roots can be activated so that only these root CA certs are trusted by the application for any TLS connections.

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Solaris C/C++

MinGW C/C++

#include <C_CkTrustedRoots.h>
#include <C_CkCert.h>

void ChilkatSample(void)
    {
    HCkTrustedRoots troots;
    BOOL success;
    int i;
    int numCerts;
    HCkCert cacert;

    troots = CkTrustedRoots_Create();

    success = CkTrustedRoots_LoadCaCertsPem(troots,"qa_data/curl_cacert.pem");
    if (success != TRUE) {
        printf("%s\n",CkTrustedRoots_lastErrorText(troots));
        CkTrustedRoots_Dispose(troots);
        return;
    }

    i = 0;
    numCerts = CkTrustedRoots_getNumCerts(troots);
    while ((i < numCerts)) {
        cacert = CkTrustedRoots_GetCert(troots,i);
        printf("%d: %s\n",i,CkCert_subjectDN(cacert));
        CkCert_Dispose(cacert);
        i = i + 1;
    }

    // Activate this specific set of trusted roots.
    success = CkTrustedRoots_Activate(troots);
    if (success != TRUE) {
        printf("%s\n",CkTrustedRoots_lastErrorText(troots));
        CkTrustedRoots_Dispose(troots);
        return;
    }

    // Output:

    // 0: C=US, O=GTE Corporation, OU="GTE CyberTrust Solutions, Inc.", CN=GTE CyberTrust Global Root
    // 1: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA, E=server-certs@thawte.com
    // 2: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA, E=premium-server@thawte.com
    // 3: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
    // 4: C=US, O="VeriSign, Inc.", OU=Class 3 Public Primary Certification Authority
    // 5: C=US, O="VeriSign, Inc.", OU=Class 3 Public Primary Certification Authority - G2, OU="(c) 1998 VeriSign, Inc. - For authorized use only", OU=VeriSign Trust Network
    // 6: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
    // 7: OU=GlobalSign Root CA - R2, O=GlobalSign, CN=GlobalSign
    // 8: L=ValiCert Validation Network, O="ValiCert, Inc.", OU=ValiCert Class 1 Policy Validation Authority, CN=http://www.valicert.com/, E=info@valicert.com
    // 9: L=ValiCert Validation Network, O="ValiCert, Inc.", OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com/, E=info@valicert.com
    // 10: L=ValiCert Validation Network, O="ValiCert, Inc.", OU=ValiCert Class 3 Policy Validation Authority, CN=http://www.valicert.com/, E=info@valicert.com
    // 11: C=US, O="VeriSign, Inc.", OU=VeriSign Trust Network, OU="(c) 1999 VeriSign, Inc. - For authorized use only", CN=VeriSign Class 3 Public Primary Certification Authority - G3
    // 12: C=US, O="VeriSign, Inc.", OU=VeriSign Trust Network, OU="(c) 1999 VeriSign, Inc. - For authorized use only", CN=VeriSign Class 4 Public Primary Certification Authority - G3
    // 13: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority
    // 14: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
    // 15: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
    // 16: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1
    // 17: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1
    // 18: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Class 1 CA Root
    // 19: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root
    // 20: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Public CA Root
    // 21: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Qualified CA Root
    // 22: C=US, O="Entrust, Inc.", OU=www.entrust.net/CPS is incorporated by reference, OU="(c) 2006 Entrust, Inc.", CN=Entrust Root Certification Authority
    // 23: O=RSA Security Inc, OU=RSA Security 2048 V3
    // 24: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
    // 25: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA 2
    // 26: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA
    // 27: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA 2
    // 28: C=US, O=America Online Inc., CN=America Online Root Certification Authority 1
    // 29: C=US, O=America Online Inc., CN=America Online Root Certification Authority 2
    // 30: C=US, O=VISA, OU=Visa International Service Association, CN=Visa eCommerce Root
    // 31: C=PL, O=Unizeto Sp. z o.o., CN=Certum CA
    // 32: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
    // 33: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Secure Certificate Services
    // 34: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Trusted Certificate Services
    // 35: C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority
    // 36: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
    // 37: C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
    // 38: C=JP, O=SECOM Trust.net, OU=Security Communication RootCA1
    // 39: C=FI, O=Sonera, CN=Sonera Class2 CA
    // 40: C=NL, O=Staat der Nederlanden, CN=Staat der Nederlanden Root CA
    // 41: C=DK, O=TDC Internet, OU=TDC Internet Root CA
    // 42: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN - DATACorp SGC
    // 43: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware
    // 44: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Chambers of Commerce Root
    // 45: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Global Chambersign Root
    // 46: C=HU, ST=Hungary, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Kozjegyzoi (Class A) Tanusitvanykiado
    // 47: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Uzleti (Class B) Tanusitvanykiado
    // 48: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Expressz (Class C) Tanusitvanykiado
    // 49: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority
    // 50: C=US, O="The Go Daddy Group, Inc.", OU=Go Daddy Class 2 Certification Authority
    // 51: C=US, O="Starfield Technologies, Inc.", OU=Starfield Class 2 Certification Authority
    // 52: C=IL, O=StartCom Ltd., OU=Secure Digital Certificate Signing, CN=StartCom Certification Authority
    // 53: C=TW, O=Government Root Certification Authority
    // 54: C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1
    // 55: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
    // 56: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
    // 57: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
    // 58: C=FR, O=Certplus, CN=Class 2 Primary CA
    // 59: O=Digital Signature Trust Co., CN=DST Root CA X3
    // 60: C=US, O=Digital Signature Trust, OU=DST ACES, CN=DST ACES CA X6
    // 61: CN=TRKTRUST Elektronik Sertifika Hizmet Saglayicisi, C=TR, L=ANKARA, O=(c) 2005 TRKTRUST Bilgi Iletisim ve Bilisim Gvenligi Hizmetleri A.S.
    // 62: CN=TRKTRUST Elektronik Sertifika Hizmet Saglayicisi, C=TR, L=Ankara, O=TRKTRUST Bilgi Iletisim ve Bilisim Gvenligi Hizmetleri A.S. (c) Kasim 2005
    // 63: C=CH, O=SwissSign AG, CN=SwissSign Gold CA - G2
    // 64: C=CH, O=SwissSign AG, CN=SwissSign Silver CA - G2
    // 65: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority
    // 66: C=US, O="thawte, Inc.", OU=Certification Services Division, OU="(c) 2006 thawte, Inc. - For authorized use only", CN=thawte Primary Root CA
    // 67: C=US, O="VeriSign, Inc.", OU=VeriSign Trust Network, OU="(c) 2006 VeriSign, Inc. - For authorized use only", CN=VeriSign Class 3 Public Primary Certification Authority - G5
    // 68: C=US, O=SecureTrust Corporation, CN=SecureTrust CA
    // 69: C=US, O=SecureTrust Corporation, CN=Secure Global CA
    // 70: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO Certification Authority
    // 71: C=US, O=Network Solutions L.L.C., CN=Network Solutions Certificate Authority
    // 72: C=US, O=Wells Fargo WellsSecure, OU=Wells Fargo Bank NA, CN=WellsSecure Public Root Certificate Authority
    // 73: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO ECC Certification Authority
    // 74: C=FR, ST=France, L=Paris, O=PM/SGDN, OU=DCSSI, CN=IGC/A, E=igca@sgdn.pm.gouv.fr
    // 75: C=JP, O="SECOM Trust Systems CO.,LTD.", OU=Security Communication EV RootCA1
    // 76: C=CH, O=WISeKey, OU=Copyright (c) 2005, OU=OISTE Foundation Endorsed, CN=OISTE WISeKey Global Root GA CA
    // 77: C=HU, L=Budapest, O=Microsec Ltd., OU=e-Szigno CA, CN=Microsec e-Szigno Root CA
    // 78: C=FR, O=Dhimyotis, CN=Certigna
    // 79: C=CO, O=Sociedad Cameral de Certificacin Digital - Certicmara S.A., CN=AC Raz Certicmara S.A.
    // 80: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Class 2 CA, CN=TC TrustCenter Class 2 CA II
    // 81: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Class 3 CA, CN=TC TrustCenter Class 3 CA II
    // 82: C=DE, O=TC TrustCenter GmbH, OU=TC TrustCenter Universal CA, CN=TC TrustCenter Universal CA I
    // 83: C=DE, O=Deutsche Telekom AG, OU=T-TeleSec Trust Center, CN=Deutsche Telekom Root CA 2
    // 84: CN=ComSign Secured CA, O=ComSign, C=IL
    // 85: O="Cybertrust, Inc", CN=Cybertrust Global Root
    // 86: C=TW, O="Chunghwa Telecom Co., Ltd.", OU=ePKI Root Certification Authority
    // 87: C=TR, L=Gebze - Kocaeli, O=Trkiye Bilimsel ve Teknolojik Arastirma Kurumu - TBITAK, OU=Ulusal Elektronik ve Kriptoloji Arastirma Enstits - UEKAE, OU=Kamu Sertifikasyon Merkezi, CN=TBITAK UEKAE Kk Sertifika Hizmet Saglayicisi - Srm 3
    // 88: C=NO, O=Buypass AS-983163327, CN=Buypass Class 2 CA 1
    // 89: C=NO, O=Buypass AS-983163327, CN=Buypass Class 3 CA 1
    // 90: CN=EBG Elektronik Sertifika Hizmet Saglayicisi, O=EBG Bilisim Teknolojileri ve Hizmetleri A.S., C=TR
    // 91: C=RO, O=certSIGN, OU=certSIGN ROOT CA
    // 92: C=CN, O=CNNIC, CN=CNNIC ROOT
    // 93: C=JP, O=Japanese Government, OU=ApplicationCA
    // 94: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3
    // 95: C=US, O="thawte, Inc.", OU="(c) 2007 thawte, Inc. - For authorized use only", CN=thawte Primary Root CA - G2
    // 96: C=US, O="thawte, Inc.", OU=Certification Services Division, OU="(c) 2008 thawte, Inc. - For authorized use only", CN=thawte Primary Root CA - G3
    // 97: C=US, O=GeoTrust Inc., OU=(c) 2007 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G2
    // 98: C=US, O="VeriSign, Inc.", OU=VeriSign Trust Network, OU="(c) 2008 VeriSign, Inc. - For authorized use only", CN=VeriSign Universal Root Certification Authority
    // 99: C=US, O="VeriSign, Inc.", OU=VeriSign Trust Network, OU="(c) 2007 VeriSign, Inc. - For authorized use only", CN=VeriSign Class 3 Public Primary Certification Authority - G4
    // 100: C=HU, L=Budapest, O=NetLock Kft., OU=Tanstvnykiadk (Certification Services), CN=NetLock Arany (Class Gold) Fotanstvny
    // 101: C=NL, O=Staat der Nederlanden, CN=Staat der Nederlanden Root CA - G2
    // 102: C=SK, L=Bratislava, O=Disig a.s., CN=CA Disig
    // 103: E=pki@sk.ee, C=EE, O=AS Sertifitseerimiskeskus, CN=Juur-SK
    // 104: C=HK, O=Hongkong Post, CN=Hongkong Post Root CA 1
    // 105: C=JP, O="Japan Certification Services, Inc.", CN=SecureSign RootCA11
    // 106: CN=ACEDICOM Root, OU=PKI, O=EDICOM, C=ES
    // 107: C=HU, L=Budapest, O=Microsec Ltd., CN=Microsec e-Szigno Root CA 2009, E=info@e-szigno.hu
    // 108: C=TR, O=Elektronik Bilgi Guvenligi A.S., CN=e-Guven Kok Elektronik Sertifika Hizmet Saglayicisi
    // 109: OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign
    // 110: C=ES, CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
    // 111: C=ES, O=IZENPE S.A., CN=Izenpe.com
    // 112: C=EU, L=Madrid (see current address at www.camerfirma.com/address), SERIALNUMBER=A82743287, O=AC Camerfirma S.A., CN=Chambers of Commerce Root - 2008
    // 113: C=EU, L=Madrid (see current address at www.camerfirma.com/address), SERIALNUMBER=A82743287, O=AC Camerfirma S.A., CN=Global Chambersign Root - 2008
    // 114: C=US, ST=Arizona, L=Scottsdale, O="GoDaddy.com, Inc.", CN=Go Daddy Root Certificate Authority - G2
    // 115: C=US, ST=Arizona, L=Scottsdale, O="Starfield Technologies, Inc.", CN=Starfield Root Certificate Authority - G2
    // 116: C=US, ST=Arizona, L=Scottsdale, O="Starfield Technologies, Inc.", CN=Starfield Services Root Certificate Authority - G2
    // 117: C=US, O=AffirmTrust, CN=AffirmTrust Commercial
    // 118: C=US, O=AffirmTrust, CN=AffirmTrust Networking
    // 119: C=US, O=AffirmTrust, CN=AffirmTrust Premium
    // 120: C=US, O=AffirmTrust, CN=AffirmTrust Premium ECC
    // 121: C=PL, O=Unizeto Technologies S.A., OU=Certum Certification Authority, CN=Certum Trusted Network CA
    // 122: C=FR, O=Certinomis, OU=0002 433998903, CN=Certinomis - Autorit Racine
    // 123: C=ES, O=Generalitat Valenciana, OU=PKIGVA, CN=Root CA Generalitat Valenciana
    // 124: C=AT, O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH, OU=A-Trust-nQual-03, CN=A-Trust-nQual-03
    // 125: C=TW, O=TAIWAN-CA, OU=Root CA, CN=TWCA Root Certification Authority
    // 126: C=JP, O="SECOM Trust Systems CO.,LTD.", OU=Security Communication RootCA2
    // 127: C=ES, O=Agencia Catalana de Certificacio (NIF Q-0801176-I), OU=Serveis Publics de Certificacio, OU=Vegeu https://www.catcert.net/verarrel (c)03, OU=Jerarquia Entitats de Certificacio Catalanes, CN=EC-ACC
    // 128: C=GR, O=Hellenic Academic and Research Institutions Cert. Authority, CN=Hellenic Academic and Research Institutions RootCA 2011
    // 129: C=IT, L=Milan, O=Actalis S.p.A./03358520967, CN=Actalis Authentication Root CA
    // 130: C=GB, O=Trustis Limited, OU=Trustis FPS Root CA
    // 131: C=IL, O=StartCom Ltd., CN=StartCom Certification Authority G2
    // 132: C=NO, O=Buypass AS-983163327, CN=Buypass Class 2 Root CA
    // 133: C=NO, O=Buypass AS-983163327, CN=Buypass Class 3 Root CA
    // 134: C=DE, O=T-Systems Enterprise Services GmbH, OU=T-Systems Trust Center, CN=T-TeleSec GlobalRoot Class 3
    // 135: C=EE, O=AS Sertifitseerimiskeskus, CN=EE Certification Centre Root CA, E=pki@sk.ee
    // 136: CN=TRKTRUST Elektronik Sertifika Hizmet Saglayicisi, C=TR, L=Ankara, O=TRKTRUST Bilgi Iletisim ve Bilisim Gvenligi Hizmetleri A.S. (c) Aralik 2007
    // 137: C=DE, O=D-Trust GmbH, CN=D-TRUST Root Class 3 CA 2 2009
    // 138: C=DE, O=D-Trust GmbH, CN=D-TRUST Root Class 3 CA 2 EV 2009
    // 139: E=contacto@procert.net.ve, L=Chacao, ST=Miranda, OU=Proveedor de Certificados PROCERT, O=Sistema Nacional de Certificacion Electronica, C=VE, CN=PSCProcert
    // 140: C=CN, O=China Internet Network Information Center, CN=China Internet Network Information Center EV Certificates Root
    // 141: C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 2
    // 142: C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root EV CA 2
    // 143: C=SK, L=Bratislava, O=Disig a.s., CN=CA Disig Root R1
    // 144: C=SK, L=Bratislava, O=Disig a.s., CN=CA Disig Root R2
    // 145: CN=ACCVRAIZ1, OU=PKIACCV, O=ACCV, C=ES
    // 146: C=TW, O=TAIWAN-CA, OU=Root CA, CN=TWCA Global Root CA
    // 147: O=TeliaSonera, CN=TeliaSonera Root CA v1
    // 148: C=TR, L=Ankara, O=E-Tugra EBG Bilisim Teknolojileri ve Hizmetleri A.S., OU=E-Tugra Sertifikasyon Merkezi, CN=E-Tugra Certification Authority
    // 149: C=DE, O=T-Systems Enterprise Services GmbH, OU=T-Systems Trust Center, CN=T-TeleSec GlobalRoot Class 2
    // 150: CN=Atos TrustedRoot 2011, O=Atos, C=DE
    // 


    CkTrustedRoots_Dispose(troots);

    }

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.