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

VB.NET 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

 

 

 

(VB.NET) Convert PFX to Encrypted PEM

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

Chilkat .NET Downloads

Chilkat .NET Framework

Chilkat for .NET Core

Dim pfx As New Chilkat.Pfx

Dim success As Boolean = pfx.LoadPfxFile("qa_data/pfx/myCert.pfx","secret")
If (success <> True) Then
    Debug.WriteLine(pfx.LastErrorText)
    Exit Sub
End If


' If extendedAttrs is True, then extended properties (Bag Attributes and Key Attributes) are included in the output.
Dim extendedAttrs As Boolean = False
' Set noKeys = True to omit private keys from the output.
Dim noKeys As Boolean = False
' Set noCerts = True to omit certificates from the output.
Dim noCerts As Boolean = False
' Set noCaCerts = True to omit CA certificates from the output.
Dim noCaCerts As Boolean = False
' The encrypt algorithm can be "des3", "aes128", "aes192", or "aes256"
Dim encryptAlg As String = "aes128"
Dim pemPassword As String = "myPemPassword"

Dim strPem As String = pfx.ToPemEx(extendedAttrs,noKeys,noCerts,noCaCerts,encryptAlg,pemPassword)
Debug.WriteLine(strPem)

' Sample output:
' 

' -----BEGIN ENCRYPTED PRIVATE KEY-----
' MIIFLzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIUTSIiX9LffYCAggA
' ...
' ...
' ...
' JHIkvQ0sld9EIyKhqG2ep+H7V6n6CcQp9sQx1VGgvOQjK9Q=
' -----END ENCRYPTED PRIVATE KEY-----
' -----BEGIN CERTIFICATE-----
' MIIFRjCCBC6gAwIBAgIRALgZeKhNjDgwdOQuYedzOVAwDQYJKoZIhvcNAQELBQAw
' gZsxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
' BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMUEwPwYD
' VQQDEzhDT01PRE8gU0hBLTI1NiBDbGllbnQgQXV0aGVudGljYXRpb24gYW5kIFNl
' Y3VyZSBFbWFpbCBDQTAeFw0xNjAzMTgwMDAwMDBaFw0xNzAzMTgyMzU5NTlaMCgx
' JjAkBgkqhkiG9w0BCQEWF3N1cHBvcnRAY2hpbGth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