CryptographicException: Object already exists

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
alexdodo
Posts: 4
Joined: Thu Jun 26, 2014 11:43 am

CryptographicException: Object already exists

Post by alexdodo » Thu Jun 26, 2014 12:47 pm

I have 10 computers in my network with vault client (Version=5.1.1.19215) (with windows 7 and win 2k8 R2).
Yesterday one computer with win 2k8 R2 stopped working
In the client log say:

6/26/2014 11:38:16 AM <generic>: [<No Name>:3364] VaultGUIClient, Version=5.1.1.19215, Culture=neutral, PublicKeyToken=null
6/26/2014 11:38:25 AM <generic>: [GUIClientWorkerThread:4444] [System.Security.Cryptography.CryptographicException: Object already exists.

at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.Utils._CreateCSP(CspParameters param, Boolean randomKeyContainer, SafeProvHandle& hProv)
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.get_PersistKeyInCsp()
at System.Security.Cryptography.RSACryptoServiceProvider.set_PersistKeyInCsp(Boolean value)
at VaultLib.VaultUserCrypt.EncryptPassword(String strUnencryptedPassword, Byte[] publicKey, Byte[] exponent, String& strEncryptedPassword, String& strRMKey)
at VaultClientNetLib.VaultConnection.Login(String strURLBase, String strUserLogin, String strPassword)
at VaultClientOperationsLib.ClientInstance.Login(String urlbase, String username, String password)
at VaultClientPresentationLib.GUIClientInstance.ConnectToServer(String& outserverPath, Boolean forceDialogShow, String& outprofileName, String& outusername, Boolean& outbUseSSL, Boolean& outbAutoLogin)
at VaultClientPresentationLib.GUIClientThread.ProcessCommand(GUIClientThreadCommand command, GUIClientThreadCommandResult& outputResult)] Object already exists.

at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.Utils._CreateCSP(CspParameters param, Boolean randomKeyContainer, SafeProvHandle& hProv)
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.get_PersistKeyInCsp()
at System.Security.Cryptography.RSACryptoServiceProvider.set_PersistKeyInCsp(Boolean value)
at VaultLib.VaultUserCrypt.EncryptPassword(String strUnencryptedPassword, Byte[] publicKey, Byte[] exponent, String& strEncryptedPassword, String& strRMKey)
at VaultClientNetLib.VaultConnection.Login(String strURLBase, String strUserLogin, String strPassword)
at VaultClientOperationsLib.ClientInstance.Login(String urlbase, String username, String password)
at VaultClientPresentationLib.GUIClientInstance.ConnectToServer(String& outserverPath, Boolean forceDialogShow, String& outprofileName, String& outusername, Boolean& outbUseSSL, Boolean& outbAutoLogin)
at VaultClientPresentationLib.GUIClientThread.ProcessCommand(GUIClientThreadCommand command, GUIClientThreadCommandResult& outputResult)

Stack Trace:
at VaultClientPresentationLib.GUIClientInstance.ShowCommandException(Exception e, IWin32Window dialogOwner)
at VaultClientPresentationLib.GUIClientThread.ProcessCommand(GUIClientThreadCommand command, GUIClientThreadCommandResult& outputResult)
at VaultClientPresentationLib.GUIClientThread.Start()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

6/26/2014 11:38:29 AM <generic>: [<No Name>:1592] SimpleLogger finalized


Im follow the solution in the post http://support.sourcegear.com/viewtopic ... ion#p75376 but I can't fix the problem (in win 2k8 the folder %ALLUSERSPROFILE%\Application Data\Microsoft\Crypto\RSA\MachineKeys don't exists, the folder in win2k8 R2 is C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys, i think so).

I have 3 or 4 computers with the same wind2k8 R2 and don't have any problem (in windos 7 I have one computer with another error, I put a post with the description)

The server log don't show any message about this computer, but there are many error with the code:

Exception in plugin thread : The request failed with HTTP status 404: Not Found.

I don't know if this message is important

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: CryptographicException: Object already exists

Post by Beth » Fri Jun 27, 2014 2:46 pm

You have the path for the Machine Keys folder correct (C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys). The post I wrote was for Windows XP and Windows 2003 Server. Everything later uses the path you listed.

Give the account that Vault runs under read/write/modify rights to the MachineKeys folder.
Beth Kieler
SourceGear Technical Support

alexdodo
Posts: 4
Joined: Thu Jun 26, 2014 11:43 am

Re: CryptographicException: Object already exists

Post by alexdodo » Tue Jul 01, 2014 11:03 am

Tks for your help.

In the vault client I put rights to everyone, and run the vault client like administrator, but I have the same error.

In the server side, the rights are ok (I think so). Vault server is used by 10 clients, so I don't want to move nothing from the configuration.

So, I put 3 images:
- The rights in the vault client computer (on directory C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys).
- The message error on the vault client computer
- The rights in the vault server (on directory C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys).
Attachments
server.vault.png
Server vault rights
server.vault.png (55.95 KiB) Viewed 6912 times
diana.vault.error.png
Message error on vault client
diana.vault.error.png (30.23 KiB) Viewed 6912 times
diana.vault.right.png
Rights on vault client
diana.vault.right.png (75.65 KiB) Viewed 6912 times

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: CryptographicException: Object already exists

Post by Beth » Tue Jul 01, 2014 12:51 pm

On the Vault server, what are the rights for Network Service?
Beth Kieler
SourceGear Technical Support

Post Reply