# Getting a list of certificates to choose from for pdf signing

**URL:** <https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541>\
**Category:** questions\
**Tags:** security, pdf\
**Created:** [August 27, 2023, 1:39pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541 "2023-08-27T13:39:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bostjan\_Laba](https://clarionhub.com/user_avatar/clarionhub.com/bostjan_laba/32/2498_2.png) [@Bostjan\_Laba](https://clarionhub.com/u/Bostjan_Laba)\
**Post date:** [August 27, 2023, 1:39pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541/1 "2023-08-27T13:39:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![noyantis](https://clarionhub.com/user_avatar/clarionhub.com/noyantis/32/922_2.png) [@noyantis](https://clarionhub.com/u/noyantis)\
**Post date:** [August 27, 2023, 4:12pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541/2 "2023-08-27T16:12:34Z")

</div>

Hi Bostjan,

Take a look at the Chilkat library:

> **[Chilkat API, SDK, Components, Libs for Windows, MacOS, Linux, iOS, Android,...](https://www.chilkatsoft.com/)**
>
> Chilkat Software: Cross-Platform/Cross-Language API's for SSH/SFTP, FTP, Email, Encryption, Zip, S/MIME, XML, EML, MHT, FTP, SSL, TLS, and more

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:

[https://noyantis.com/product/chilkat/](https://noyantis.com/product/chilkat/)

Hope this helps…

Thanks, Andy

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [August 27, 2023, 10:52pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541/3 "2023-08-27T22:52:25Z")

</div>

Here’s a C program that doesn’t look all that difficult (famous last words 🙂 ) to port to Clarion. [Example C Program: Listing the Certificates in a Store - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/seccrypto/example-c-program-listing-the-certificates-in-a-store)

---

<div class="post-metadata">

**Author:** ![Bostjan\_Laba](https://clarionhub.com/user_avatar/clarionhub.com/bostjan_laba/32/2498_2.png) [@Bostjan\_Laba](https://clarionhub.com/u/Bostjan_Laba)\
**Post date:** [August 28, 2023, 5:41pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541/4 "2023-08-28T17:41:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bostjan\_Laba](https://clarionhub.com/user_avatar/clarionhub.com/bostjan_laba/32/2498_2.png) [@Bostjan\_Laba](https://clarionhub.com/u/Bostjan_Laba)\
**Post date:** [August 28, 2023, 9:25pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541/5 "2023-08-28T21:25:50Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [August 28, 2023, 9:53pm UTC](https://clarionhub.com/t/getting-a-list-of-certificates-to-choose-from-for-pdf-signing/6541/6 "2023-08-28T21:53:37Z")

</div>

According to this page, pvData could contain a multitude of different things, depending on whatever conditions. [CertGetCertificateContextProperty function (wincrypt.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certgetcertificatecontextproperty)

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
