Created
October 4, 2014 00:39
-
-
Save baywet/4a25e3b4ee485b30258a to your computer and use it in GitHub Desktop.
sample on how to convert a pfx to snk visual studio assembly signing certificate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X509Certificate2 cert = new X509Certificate2(@"KEY.pfx", "pfxPassword", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); | |
RSACryptoServiceProvider provider = (RSACryptoServiceProvider) cert.PrivateKey; | |
byte[] array = provider.ExportCspBlob(!provider.PublicOnly); | |
using (FileStream fs = new FileStream("FileName.snk", FileMode.Create, FileAccess.Write)) | |
{ | |
fs.Write(array, 0, array.Length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment