Visual FoxPro
Visual FoxPro
Import a Certificate (.cer file) into a Windows Certificate Store
See more Certificates Examples
Demonstrates how to import a certificate (without private key) into a Windows certificate store.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loCert
LOCAL loCertStoreCU
LOCAL lnReadOnlyFlag
lnSuccess = 0
loCert = CreateObject('Chilkat.Cert')
lnSuccess = loCert.LoadFromFile("qa_data/certs/example.cer")
IF (lnSuccess = 0) THEN
? loCert.LastErrorText
RELEASE loCert
CANCEL
ENDIF
loCertStoreCU = CreateObject('Chilkat.CertStore')
lnReadOnlyFlag = 0
* "CurrentUser" and "My" are the exact keywords to select your user account's certificate store.
lnSuccess = loCertStoreCU.OpenWindowsStore("CurrentUser","My",lnReadOnlyFlag)
IF (lnSuccess = 0) THEN
? "Failed to open the CurrentUser/My certificate store for read/write."
RELEASE loCert
RELEASE loCertStoreCU
CANCEL
ENDIF
* Import the certificate into the CurrentUser/My certificate store.
lnSuccess = loCertStoreCU.AddCertificate(loCert)
IF (lnSuccess = 0) THEN
? loCertStoreCU.LastErrorText
RELEASE loCert
RELEASE loCertStoreCU
CANCEL
ENDIF
? "Imported " + loCert.SubjectCN
? "Success."
RELEASE loCert
RELEASE loCertStoreCU