Location of container for public and private keys in Windows?

后端 未结 2 1027
再見小時候
再見小時候 2021-02-05 22:06

I am trying to store my public and private keys in a container using following code:

CspParameters cp = new CspParameters();
cp.KeyContainerName = \"Test\";
RSAC         


        
2条回答
  •  Happy的楠姐
    2021-02-05 22:10

    I used Process Monitor and Sn.exe (Strong Name Tool) to learn the location of the folder on my Windows 7 machine that contains my key files and thereby confirm the information in Joe's answer.

    First, I ran Process Monitor and specified the following filter:

    Column    Relation    Value    Action
    ---------------------------------------
    Path      contains    crypto   Include
    

    I then ran Strong Name Tool (sn.exe) to extract the public key from the key pair in my container VS_KEY_773685D47C32F8C7 and export it to public_key.snk:

    sn.exe -pc VS_KEY_773685D47C32F8C7 public_key.snk
    

    After doing so I noted that Process Monitor indicated that sn.exe made several access requests to the folder:

    C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
    

    ...and the file that contains my public and private keys for my container named VS_KEY_773685D47C32F8C7:

    C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\74c2c10a37baa69f7969c7144db5805d_c55067c2-4a01-4792-9d70-d7a6e4799447
    

    sn.exe can be conveniently run via the Developer Command Prompt for Visual Studio.

提交回复
热议问题