views:

124

answers:

1

I have certificate imported from smart card into my certificate store

I would like to check (c# code) whether certificate is active i.e. does the smart card in the reader corresponds to my certificate

A: 

I don't have smart card reader at hand but from what I remember when you try to access private key (eg. when trying to sign or decrypt) UI from CSP will pop up asking that you insert correct card and/or provide pin number. If you use different card (so that certificate/private key won't match) then the operation will fail (my guess is that CryptographicException will be thrown). I haven't heard of generic way to query smart cards (which of course doesn't mean there isn't any).

Tomasz Grobelny