I am trying to store my public and private keys in a container using following code:
CspParameters cp = new CspParameters();
cp.KeyContainerName = \"Test\";
RSAC
You'll find the key files in the following directory (*):
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
@"Microsoft\Crypto\RSA\MachineKeys")
You can get the filename for a given key as follows:
CspParameters cp = ...;
CspKeyContainerInfo info = new CspKeyContainerInfo(cp);
string fileName = info.UniqueKeyContainerName;
I don't believe this information is documented, so if you use it you'll be relying on undocumented implementation details which may not work in future versions of Windows. Unfortunately, it's sometimes necessary to use it; for example as noted in this question, I don't think there's any other reliable way to view permissions for an RSA Key Container from a non-privileged account.
(*) that's for machine keys. User-specific keys are presumably under Environment.SpecialFolder.LocalApplicationData