Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

C++ Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
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)

Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(C++) Convert PFX to Encrypted PEM

Loads a PFX (PKCS12) and converts to encrypted PEM.

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++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <CkPfx.h>

void ChilkatSample(void)
    {
    CkPfx pfx;

    bool success = pfx.LoadPfxFile("qa_data/pfx/myCert.pfx","secret");
    if (success != true) {
        std::cout << pfx.lastErrorText() << "\r\n";
        return;
    }

    //  If extendedAttrs is true, then extended properties (Bag Attributes and Key Attributes) are included in the output.
    bool extendedAttrs = false;
    //  Set noKeys = true to omit private keys from the output.
    bool noKeys = false;
    //  Set noCerts = true to omit certificates from the output.
    bool noCerts = false;
    //  Set noCaCerts = true to omit CA certificates from the output.
    bool noCaCerts = false;
    //  The encrypt algorithm can be "des3", "aes128", "aes192", or "aes256"
    const char *encryptAlg = "aes128";
    const char *pemPassword = "myPemPassword";

    const char *strPem = pfx.toPemEx(extendedAttrs,noKeys,noCerts,noCaCerts,encryptAlg,pemPassword);
    std::cout << strPem << "\r\n";

    //  Sample output:
    // 

    //  -----BEGIN ENCRYPTED PRIVATE KEY-----
    //  MIIFLzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIUTSIiX9LffYCAggA
    //  ...
    //  ...
    //  ...
    //  JHIkvQ0sld9EIyKhqG2ep+H7V6n6CcQp9sQx1VGgvOQjK9Q=
    //  -----END ENCRYPTED PRIVATE KEY-----
    //  -----BEGIN CERTIFICATE-----
    //  MIIFRjCCBC6gAwIBAgIRALgZeKhNjDgwdOQuYedzOVAwDQYJKoZIhvcNAQELBQAw
    //  gZsxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
    //  BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMUEwPwYD
    //  VQQDEzhDT01PRE8gU0hBLTI1NiBDbGllbnQgQXV0aGVudGljYXRpb24gYW5kIFNl
    //  Y3VyZSBFbWFpbCBDQTAeFw0xNjAzMTgwMDAwMDBaFw0xNzAzMTgyMzU5NTlaMCgx
    //  JjAkBgkqhkiG9w0BCQEWF3N1cHBvcnRAY2hpbGthdHNvZnQuY29tMIIBIjANBgkq
    //  hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1SNh38NxEWARSLLmUlCxxn1CersmEhA0
    //  Ix+22Cg7zGaXEJyL86oewaoFErq1cQB4/56YG5goLGRUsHk20KCoM+zAaGMAyZha
    //  mA+YsoETaJ12KJknbz3XY1HrudOdyCY8bEEIUv7o/cXXrMhTP4tuuHb5dl25ZBio
    //  +1UAcEqfCkrKxvmjuFQ0I0u3N3xezPG1RNWdmiI9G/bEtXGK0dD+9waAFD+7uKLF
    //  uVhPV75LUYmJAT352NMddiP/qCqij53lg8eTfCyyJ1PhddNCsjT+CL6EFoOKm2cz
    //  IqJ1aUy76OGgXDkejqCEOm5VLB+ldWBUHety0P5fX8CzMvaj8RxQFwIDAQABo4IB
    //  9TCCAfEwHwYDVR0jBBgwFoAUkmFrguGioKpP7GfxwqP3tIAAwewwHQYDVR0OBBYE
    //  FDTDFq26hSRzTEdIGqTl/AZAjT4kMA4GA1UdDwEB/wQEAwIFoDAMBgNVHRMBAf8E
    //  AjAAMCAGA1UdJQQZMBcGCCsGAQUFBwMEBgsrBgEEAbIxAQMFAjARBglghkgBhvhC
    //  AQEEBAMCBSAwRgYDVR0gBD8wPTA7BgwrBgEEAbIxAQIBAQEwKzApBggrBgEFBQcC
    //  ARYdaHR0cHM6Ly9zZWN1cmUuY29tb2RvLm5ldC9DUFMwXQYDVR0fBFYwVDBSoFCg
    //  ToZMaHR0cDovL2NybC5jb21vZG9jYS5jb20vQ09NT0RPU0hBMjU2Q2xpZW50QXV0
    //  aGVudGljYXRpb25hbmRTZWN1cmVFbWFpbENBLmNybDCBkAYIKwYBBQUHAQEEgYMw
    //  gYAwWAYIKwYBBQUHMAKGTGh0dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NPTU9ET1NI
    //  QTI1NkNsaWVudEF1dGhlbnRpY2F0aW9uYW5kU2VjdXJlRW1haWxDQS5jcnQwJAYI
    //  KwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTAiBgNVHREEGzAZgRdz
    //  dXBwb3J0QGNoaWxrYXRzb2Z0LmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAPSLQObU3
    //  eU+vgmydxUftZo41OBhzGz0IiN8Hqr1mBejr26Gts3QrndN8JzOwGEPQvf7d7fRe
    //  lMOd8+a6DfDm7Dbr5SwzqFti1xSe29Zj2IMxlDRYRW/ODuCfSeixl7nvilBdgiGG
    //  +Bb0wrGLq5/UeV4xP5vvtDbcWdDED0shc30Kwp5FIYbU2HJ/9gcU/0ZZEA/ml0r+
    //  Q8XDgVeSe/gLNvIjsQBxwbhrdQm911iNEFY9B33rYwqMnVuKc3OgetTxx6V6hxLz
    //  jed1eLsqxx3Lag4oaSiVsoNjyXvvvaJ1MGwEKM+Pi98w9awlSLnBLYvM+5N1NvsJ
    //  TUUKcT17pt3C5w==
    //  -----END CERTIFICATE-----
    //  -----BEGIN CERTIFICATE-----
    //  MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
    //  MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
    //  IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
    //  MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
    //  FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
    //  bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
    //  dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
    //  H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
    //  uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
    //  mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
    //  a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
    //  E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
    //  WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
    //  VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
    //  Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
    //  cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
    //  IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
    //  AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
    //  YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
    //  6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
    //  Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
    //  c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
    //  mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
    //  -----END CERTIFICATE-----
    //  -----BEGIN CERTIFICATE-----
    //  MIIErzCCA5egAwIBAgIRAOAjyxUSg1O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IKwYB
    //  BQUHAwIGCCsGAQUFBwMEMBEGA1UdIAQKMAgwBgYEVR0gADBEBgNVHR8EPTA7MDmg
    //  N6A1hjNodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vQWRkVHJ1c3RFeHRlcm5hbENB
    //  Um9vdC5jcmwwNQYIKwYBBQUHAQEEKTAnMCUGCCsGAQUFBzABhhlodHRwOi8vb2Nz
    //  cC51c2VydHJ1c3QuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQAbKm6sVcE6q4jF2O3N
    //  VfOqa2ErwAkQI5kPxWZqb7H1tLV3Xg8CYQDffQX+ErOkgIAA/PsdW2pyAgpBvAW6
    //  wVjVJsLq1U2E+/6CmM9YG+MiY5xS+LsFNqt9WKXeqztj5drVc+/s4Pt74qP/8EIj
    //  nMq2jU0+5EsYA7KoLdTYu0JLkGmFENumNzToe+ABEKWcyjrHn0+ING6KZdAairup
    //  3MrKNtH0/MJkKTWv1rGncRHSA0Oxjz6a7J4yU/R2ksqGNAe5LMrmHErYmQ3BhuKQ
    //  kvtaQmojIRDpZcf11bt+6oyFIAJi6tE6ByxZxZkz8jiJ5bbpFnofeRT2ShAaJvp8
    //  ivub
    //  -----END CERTIFICATE-----
    // 
    }

 

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