Getting the Root CA Certificate SHA1 Thumbprint
Question:
(In VB6) One thing we would like to do is to read out the SHA1
fingerprint of the root ca. For example, the programm should read the user
certificate. The user certificate has a certification path. Is it possible
to read out the fingerprint of the top-level root certificate?
Answer:
Here is a sample program. The user certificate is loaded from the current-user registry-based certificate store by common name. Once you have the cert object, you can build the chain of authority and step through it. The root cert is the last in the list.
Dim cert As New ChilkatCert success = cert.LoadByCommonName("Chilkat Software, Inc.") Dim certChain As New ChilkatCertChain ' Leave the certCollection object empty.. Dim certCollection As New ChilkatCertColl success = certChain.BuildChain(cert, certCollection) NumCerts = certChain.NumCerts Dim certN As ChilkatCert For i = 0 To NumCerts - 1 Set certN = certChain.GetCert(i) MsgBox certN.SubjectDN Next ' The certificate at index NumCerts - 1 is the root. ' get the fingerprint: MsgBox "Root Thumbprint: " & certChain.GetCert(NumCerts - 1).Sha1Thumbprint
admin
0
Tags :