Getting a list of certificates to choose from for pdf signing

I’m trying to sign pdf with a certificate. It works if I manually open some certificate from the windows store, copy value of Thumbnail property and sign with it.

Now I need to provide a list of certs available in the windows store to the user of my app. How do I get a list of certs, so I can pull thumbnail from selected one?

I’ve checked CS Cryptonite but it does not seem to have such option, any other idea?

Thank you

Bostjan

Hi Bostjan,

Take a look at the Chilkat library:

It includes 100+ base classes dedicated to various activities, including Certs and CertStore, plus a Pdf class for reading and signing pdf files.

To interface into a clarion app, simply use our wrapper template:

Hope this helps…

Thanks, Andy

1 Like

Here’s a C program that doesn’t look all that difficult (famous last words :slight_smile: ) to port to Clarion. Example C Program: Listing the Certificates in a Store - Win32 apps | Microsoft Learn

I’ve managed to get some list of certs using Cryptonite. Only problem is I need to actually generate thumbprint.
Thumbprints are not stored in cert store, they are calculated at runtime. It seems thumbprint is a hashed certificate data, but I don’t think Cryptonite has this particular data available in some property.
I’ll probably have to wait for Bruce to fiddle with it, hopefully.

Jeff, I have checked your C example and managed to call the method to get hash from a cert. What I struggle with is the pvData property which is described as a “pointer to buffer where an array of BYTE values are”. So generally I get pvData back as some huge Long number and dbcData of value 20 (bytes of data in the buffer).

But i don’t know how to read this data now using pvData and length. PvData is long, while array of Bytes is supposed to be a string really.

Any clarification on this? Pointers for some reason always come up as rocket science to me somehow :frowning:

According to this page, pvData could contain a multitude of different things, depending on whatever conditions. CertGetCertificateContextProperty function (wincrypt.h) - Win32 apps | Microsoft Learn

But I’d probably take a look at the data in the debugger, or assign it to a &STRING or something.

Maybe something like this would at least let you look at the data:
MyStringRef &= YourAddress & ‘:’ & DataSize