Sample code for 30+ languages & platforms
PowerBuilder

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Cert

li_Success = 0

loo_Cert = create oleobject
li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert")
if li_rc < 0 then
    destroy loo_Cert
    MessageBox("Error","Connecting to COM object failed")
    return
end if
li_Success = loo_Cert.LoadByCommonName("Chilkat Software, Inc.")
if li_Success = 0 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Cert
    return
end if

Write-Debug loo_Cert.SubjectDN
Write-Debug "Success."


destroy loo_Cert