Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
List Digital Certificates in Current-User Certificate StoreThis Visual Basic example shows how to list the digital certificates in the current-user certificate store.
' VB program to display digital certificates in the
' current-user certificate store in the Windows registry.
Private Sub Command1_Click()
' Create our certificate store factory object.
Dim StoreCreator As ChilkatCreateCS
Set StoreCreator = New ChilkatCreateCS
' Create a certificate store object representing the registry-based
' current user certificate store.
Dim certStore As ChilkatCertStore
Set certStore = StoreCreator.OpenCurrentUserStore()
' Get the number of certificates in the store.
numCerts = certStore.NumCertificates
Text1.Text = "Number of certificates in Current User Store: " & Str(numCerts) & vbCrLf
Dim cert As ChilkatCert
Index = 0
' Loop over the certificates, get each certificate and print information about each.
For Index = 0 To numCerts - 1
Set cert = certStore.GetCertificate(Index)
Text1.Text = Text1.Text & "----------------------------" & vbCrLf
Text1.Text = Text1.Text & "Serial Number:" & cert.SerialNumber & vbCrLf
Text1.Text = Text1.Text & "Valid From: " & cert.ValidFrom & vbCrLf
Text1.Text = Text1.Text & "Valid To: " & cert.ValidTo & vbCrLf
Text1.Text = Text1.Text & "Subject:" & vbCrLf
Text1.Text = Text1.Text & " Common Name: " & cert.SubjectCN & vbCrLf
Text1.Text = Text1.Text & " Email: " & cert.SubjectE & vbCrLf
Text1.Text = Text1.Text & " Organizational Unit: " & cert.SubjectOU & vbCrLf
Text1.Text = Text1.Text & " Organization: " & cert.SubjectO & vbCrLf
Text1.Text = Text1.Text & " Locality: " & cert.SubjectL & vbCrLf
Text1.Text = Text1.Text & " State: " & cert.SubjectS & vbCrLf
Text1.Text = Text1.Text & " Country: " & cert.SubjectC & vbCrLf
Text1.Text = Text1.Text & "Issuer:" & vbCrLf
Text1.Text = Text1.Text & " Common Name: " & cert.IssuerCN & vbCrLf
Text1.Text = Text1.Text & " Email: " & cert.IssuerE & vbCrLf
Text1.Text = Text1.Text & " Organizational Unit: " & cert.IssuerOU & vbCrLf
Text1.Text = Text1.Text & " Organization: " & cert.IssuerO & vbCrLf
Text1.Text = Text1.Text & " Locality: " & cert.IssuerL & vbCrLf
Text1.Text = Text1.Text & " State: " & cert.IssuerS & vbCrLf
Text1.Text = Text1.Text & " Country: " & cert.IssuerC & vbCrLf
Next
Set certStore = Nothing
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.