Reputation: 2996
How can we generate a custom .SNK file (used to sign an assembly with a strong name), if I already have my private/public key pair (in arbitrary format, but for the sake of the clarity, let's say we've generated it on linux, using ssh-keygen)?
Upvotes: 2
Views: 1915
Reputation: 127
You can store the keys in Microsoft CNG formerly CSP and the SNK can be easily pointing to the Key container .. that way you can even have the keys store in an HSM, this however create a problem with sharing keys on different machine .. if the keys are on a pkcs12 file you can easily make a batch file to store it in the KeyContainer and then use it
So you same key pairs on each machine which can be security if these keys are very important.
On other hand you can use also the CSP or CNG Provider
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<KeyContainerName>YOUR_CONTAINER_NAME_HERE</KeyContainerName>
</PropertyGroup>
If you also want the key to show up in the 'properties' section of the project then you can add the following section
<None Include="$(KEY_CONTAINER_HERE)">
<Link>Properties\App.snk</Link>
</None>
If you can generate pk12 or pfx file .. with the key pairs, then you can use sn.exe -i .. to generate p12 file you can use openssl
Upvotes: 0