Lianja
Lianja
Load P7B and List Certificates
Demonstrates how to load a .p7b containing certificates and accesses each individual certificate.Chilkat Lianja Downloads
llSuccess = .F.
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
llSuccess = .F.
loPem = createobject("CkPem")
// Load the .p7b from a file.
llSuccess = loPem.LoadP7bFile("/Users/chilkat/testData/p7b/myCerts.p7b")
if (llSuccess <> .T.) then
? loPem.LastErrorText
release loPem
return
endif
lnNumCerts = loPem.NumCerts
if (lnNumCerts = 0) then
? ("Error: Expected the .p7b to contain certificates.")
release loPem
return
endif
// Access each certificate and show the DN (Distinguished Name)
for i = 1 to lnNumCerts
loCert = loPem.GetCert(i - 1)
? str(i) + ": " + loCert.SubjectDN
release loCert
next
release loPem