Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Export Certificate to .cer FileVisual Basic example program showing how to export a certificate to a .cer file. Private Sub Command1_Click()
' Create an object for creating CertStore objects.
Dim ccs As New ChilkatCreateCS
' Open the Current User Certificate Store (from the registry)
Dim certStore As ChilkatCertStore
Set certStore = ccs.OpenCurrentUserStore()
' Find the certificate having the email address "support@chilkatsoft.com"
Dim cert As ChilkatCert
Set cert = certStore.FindCertBySubjectE("support@chilkatsoft.com")
Dim encodedCert As String
encodedCert = cert.GetEncoded()
' This code uses the CkData object to write to a file,
' but this can be replaced with any code that writes a string to a file.
' (The CkData object is found in the ChilkatUtil.dll)
Dim d As New CkData
d.AppendString "-----BEGIN CERTIFICATE-----" & vbCrLf
d.AppendString encodedCert & vbCrLf
d.AppendString "-----END CERTIFICATE-----" & vbCrLf
d.SaveToFile "exported.cer"
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.