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
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).
精彩评论