Emin Javadov
Emin Javadov

Reputation: 140

How to Extract X509 certificate Smart Card

I need programmatically extract or import X509 certificate from Smart Card without saving it to personal store. Does anyone know the way to implement it? C sharp language. I can sign with Smart Card CSP. But dont know how read certificate from Smart card

Upvotes: 2

Views: 9010

Answers (2)

guidot
guidot

Reputation: 5333

From smart card point of view, a X.509 certificate is just a binary file, but one needs to find and address the correct file, a functionality provided by the PKCS#11 support for the card.

While the following link is for a thin python layer on top of pkcs #11, the last example may serve as starting point for C# also.

official PyKCS11 module, with sources

Upvotes: 2

EricLaw
EricLaw

Reputation: 57075

As far as I understand things, when a SmartCard is inserted, the certificates on it are seamlessly (by Windows) made to appear within the user's Personal Store.

Hence, enumerating the certificates of the Personal store with the card in will reveal the certificate, which you can then Export/copy to wherever you want.

Upvotes: 3

Related Questions