.NET Framework Developer Center > .NET Framework Forums > Common Language Runtime > Extracting keyset from a password-protected pfx file

Unanswered Extracting keyset from a password-protected pfx file

  • Thursday, January 11, 2007 11:05 AM
     
     

    I've signed my assemblies using the VS C# .NET IDE, with a password-protected key container file. I also want to obfuscate my assemblies as a post-build event. This will cause the signature to become invalid. So I tried to extract the keyset from the pfx in order to re-sign the assemblies, but the following error will occure:

    >>command prompt> sn -pc key.pfx key.snk


    Microsoft (R) .NET Framework Strong Name Utility  Version 2.0.50727.42
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Failed to extract public key from key pair -- Keyset does not exist

    What should I do now?

All Replies

  • Wednesday, March 07, 2007 12:19 AM
     
     

    SN's -pc switch will extract the public key from a key container on the machine, rather than the certificate itself.  You can use -p switch to extract directly from the PFX file.  If you really want to use the key container you can put the cert's keys in a key container using SN's -i switch.

    Brian Stern [MSFT]