Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Create a New File-Based Certificate StoreThis Visual Basic example program creates a new certificate store file and copies certificates from the Outlook registry-based cert store to the file certificate store. ' Visual Basic program to create a new file-based certificate store.
Private Sub Command1_Click()
' Create the Cert Store Creator
Dim csCreator As ChilkatCreateCS
Set csCreator = New ChilkatCreateCS
csCreator.ReadOnly = 0
'Set fs = CreateObject("Scripting.FileSystemObject")
'fs.DeleteFile "myStore.sto"
' Create a new certificate store
Dim cs0 As ChilkatCertStore
Set cs0 = csCreator.CreateFileStore("c:\myStore.sto")
' Open an existing store.
Dim cs1 As ChilkatCertStore
Set cs1 = csCreator.OpenOutlookStore()
Text1.Text = Text1.Text & "Adding certs from Outlook store..." & vbCrLf
Dim cert As ChilkatCert
For i = 0 To cs1.NumCertificates - 1
Set cert = cs1.GetCertificate(i)
cs0.AddCertificate cert
Text1.Text = Text1.Text & "CN=" & cert.SubjectCN & ",E=" & cert.SubjectE & ",O=" & cert.SubjectO & vbCrLf
Next
Text1.Text = Text1.Text & "-------------------------" & vbCrLf
Label1.Caption = "Status: " & Str(cs1.NumCertificates) & " loaded into new cert store"
Set cs0 = Nothing
Set cs1 = Nothing
' Now open the file store and read the certs.
Text1.Text = Text1.Text & "Opening the certificate store just created..." & vbCrLf
Set cs0 = csCreator.OpenFileStore("c:\myStore.sto", True)
Text1.Text = Text1.Text & "Number of certificates = " & cs0.NumCertificates & vbCrLf
For i = 0 To cs0.NumCertificates - 1
Set cert = cs0.GetCertificate(i)
Text1.Text = Text1.Text & "CN=" & cert.SubjectCN & ",E=" & cert.SubjectE & ",O=" & cert.SubjectO & vbCrLf
Next
csCreator.SaveXmlLog "log.xml"
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.