开发者

How to convert .snk file to .pfx file

How does one convert a .snk file (for strong-name signing .NET assemblies) into a password protected .pfx file suitable for the same purpose?

Edit: to clarify, suppose I create a project in VS and in project properties, Signing, click 'New strong name key file', and elect not to protect the key file with a passwor开发者_如何转开发d:

How to convert .snk file to .pfx file

Now imagine that a year later I change my mind and want to add a password - without trashing the assembly's identity by creating a new keypair. How do I do this?


You do not convert however you can sign an existing snk file using the Strong Name Tool (Sn.exe). (There are a few steps involved if the snk is already been protected as you need to split the strong-name part from the certificate).

The pfx is a private certificate that is created for you in Visual Studio when you select the password protection option. The password you enter is used to protect this certificate.

Is this for development or for commercial release? I would not recommend signing the assemblies with private key for development.

From the CLR Inside Out Article:

While password-protecting your key files is a much better solution than storing them in the clear, it is still not ideal. You would still have to distribute the PFX file to all of your developers, and they would all have to know the password for the PFX file. Secrets that are widely shared like this do not tend to stay secret for very long. Ideally, you should not have to distribute the private key to build and test your code during development.

Read CLR Inside Out (MSDN) Article on Using Strong Name Signatures.

HTH,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜