RSACryptoServiceProvider and UseMachineKeyStore gives 'Object Already Exists' RRS feed

  • Question

  • Visual Studio 2005 - C#

    Use RSACryptoServiceProvider with UseMachineKeyStore flag. When second user tries to access provider they get 'Object already exists'. From other discussions it seems this is because the file created in crypto/rsa/MachineKeys has the wrong access rights and that you have to search for the right file and manually change the access rights.

    is that really the best way? That's terrible. UseMachineKeyStore is supposed to provide keys for all users. Surely there must be a proper way to do it, not messing around with file access rights? 

    a bit of code. this is fine for first user but gives error for all other users:

    CspParameters cspParameters = new CspParameters();

    cspParameters.KeyContainerName ="MY_KEY";

    cspParameters.Flags =CspProviderFlags.UseMachineKeyStore;

    RSACryptoServiceProvider rsaCsp = new RSACryptoServiceProvider(384, cspParameters);




    • Edited by Paul Zhou Wednesday, March 16, 2011 8:25 AM font fomat
    Monday, March 14, 2011 10:16 PM


All replies