Posted By: kettch | Feb 22nd, 2007 @ 3:09 PM
page 1 of 1
Comments: 3 | Views: 4305

I'm trying to make an asymmetric key available across all users of a machine.

Dim cp As New CspParameters()
cp.KeyContainerName = "testCon"
cp.Flags = CspProviderFlags.UseMachineKeyStore
Dim rsa As New RSACryptoServiceProvider(cp)
rsa.PersistKeyInCsp = False
rsa.Clear()
cp = New CspParameters()
cp.KeyContainerName = "testCon"
cp.Flags = CspProviderFlags.UseMachineKeyStore
rsa = New RSACryptoServiceProvider(cp)

First of all, is that the correct way to do it? This is what I was able to figure out from the oh-so-helpful documentation.

Second, if I run this from an admin account, and then run it from a limited account, I get an "Object already exists" error. I'm assuming that this is some kind of permissions issue? So much for storing things in the all users application data. What can I do to make it so any user across the machine can access this key container?

A limited user shouldn't be able to alter machine wide data. You probably need to create the key from an elevated process and have it persist so that others can read it.
page 1 of 1
Comments: 3 | Views: 4305
Microsoft Communities