(Visual FoxPro) Find a Certificate in the "Other People" Windows Certificate Store
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.
LOCAL loCertStore
LOCAL lnReadOnly
LOCAL lnSuccess
LOCAL loCert
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.CertStore')
loCertStore = CreateObject('Chilkat.CertStore')
* The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
lnReadOnly = 1
lnSuccess = loCertStore.OpenWindowsStore("CurrentUser","AddressBook",lnReadOnly)
IF (lnSuccess <> 1) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
CANCEL
ENDIF
loCert = loCertStore.FindCertByRfc822Name("sales.edifact@somewhere.com")
IF (loCertStore.LastMethodSuccess <> 1) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
CANCEL
ENDIF
? "Found certificate: " + loCert.SubjectDN
RELEASE loCert
RELEASE loCertStore
|