-
-
Save hongz1/b289c5534973c9e2e2ee36809887a440 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 hidden or 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