I'm trying to find some information about how to (if at all possible) enumerate all container names in the Strong Name CSP (Cryptographic Service Provider).
Essentially, when you type sn.exe -i key.snk MyContainerName
, the public and private key pairs are stored into what's called a "container". Later, within your code, you could specify the container name in the AssemblyKeyNameAttribute
, e.g.:
[assembly: AssemblyKeyName("MyContainerName")]
This will cause the assembly to be signed at compile time.
I am trying to find out if it's possible to somehow enumerate all container names. I'm writing a plugin for ReSharper that provides code completion for the InternalsVisibleTo
attribute. I'd also like to provide code completion for the AssemblyKeyName
attribute, where I would pre-populate the list with known container names.
Is this information accessible?
EDIT: From a comment on this question at IT Security StackExchange, there's a link to a little util called KeyPal. Running this utility with LM
will dump the local machine key store:
--------- KeyPal: MACHINE store: 3 keycontainers --------- [0] VS_KEY_F726FDF898BC4CB8 Signature 1024 [1] IIS Express Development Certificate Container Exchange 1024 CertE: CN=localhost [2] MyContainerName Signature 1024 -------------------------------------------------
Where I can see that both [0] and [2] are valid container names to use with AssemblyKeyName
. However, there's the [1] one - "IIS Express...", which is not a valid container. How do I distinguish between them?