CryptographicException : Keyset does not exist (issue fixed)

One of our project(SharePoint) requirements, we need to use the certificate to encrypt and decrypt the data by using the public and private key.

So the code implemented on the DEV working fine, but issue comes when code deployed on the other servers. The error was “Keyset does not exist”. The base exception class of this error is “CryptographicException”.

CryptographicException : Keyset does not exist 0(issue fixed)
RSACryptoServiceProvider rsaEncryptor = (RSACryptoServiceProvider)certificate.PrivateKey;

This exception comes when the application pool account doesn’t have access to read the certificate private key.

For this we would required to give the full access to the particular certificate.

Followings are the required steps to fixing this issue.

Application Pool account doesn’t having an permission to access the private key value

1. Login to server Press Ctrl+R type to  MMC.

2. File -> Add or remove snap-ins
3. Select Certificate click Add>> button and Click [OK]. 
4. Select Computer Account click next from wizard steps.
5. Select Local computer option and click "Finish" button.
6. Navigate to the personal from tree and select certificate. 
7. Select the certificate and right click [All Task=>Manage Private key].
8. The Permission window open and the App Pool account (where this issue comes).
9. Click OK.
10. Now you the user will able to access the certificate problem solved.

Popular posts from this blog

SharePoint RPC Protocols Examples Using OWSSVR.DLL

STS CryptographicException Error : Key set does not exist

Query suggestions in SP 2013 Using Rest API (/_api/search/suggest)