Reputation: 3070
I'm studying for my C# exam and currently looking through the Encryption section. In looking at the key storage section it says that you can set the container name for the key store using the CspParameters.KeyContainerName
field. My question is, since this field can be set to any string value, what prevents you from setting two names the same? And if it does prevent this, then how can you stop someone from using this to retrieve public and private key instances by attempting to store keys until they are prevented doing so?
Thanks!
Upvotes: 1
Views: 365
Reputation: 33098
what prevents you from setting two names the same?
Nothing. Using the same name later is how you load a named key. If you store-to-overwrite that means you’re replacing the key (e.g. periodic key rolling).
How can you stop someone from using this to retrieve public and private key instances by attempting to store keys until they are prevented doing so?
If you mean a human, use different accounts, user-scoped keys are different containers even with the same name.
If you mean malware, don’t worry, it’ll just enumerate the keys... it doesn’t have to fish through the infinite space of strings :)
Upvotes: 1