|
Forums -> Security Library Forum
private key is in Smartcard |
|
|
by lembas [lembas at myway dot com] posted on 2003/08/19 |
|
Dear Sir,
I have a certificate and the corresponding private key in a smartcard.
The key is not exportable.
I used the code below to get the private key and sign something.
CertificateStore cs = new CertificateStore(CertificateStore.MyStore);
CertificateStore cert = cs.EnumCertificates()[0];
RSA key = cert.PrivateKey;
Everything is ok. I can use it however I want. But is something wrong? I am supposed to get an error message when I try to get the private key, aren't I?
If everything is ok then your code is succesfully communicate with the CSP of the smartcard and sends the data to the card and receives the signature. Am I right? Please confirm me that your code is capable of doing this. So anyone using your libarary does not have to bother with CSParameters() etc... I hope I am clear.
thanks in advance |
by Pieter Philippaerts [Pieter at mentalis dot org] posted on 2003/08/19 |
|
Yes, everything is ok. The reason why the library is not throwing an error is because -even though it returns an RSA instance that corresponds to the private key- it never has to access your private key on the smart card.
If you encrypt data with the RSA instance returned by the PrivateKey property, the RSA instance calls the CryptoAPI which on its turn calls the Smart Card to encrypt the data. That way, only the smart card needs access to the private key. |
|
|