Created
May 24, 2011 13:22
-
-
Save domgreen/988684 to your computer and use it in GitHub Desktop.
Method to convert cer to pfx cert
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
public static void CreatePfxCertFromCerCertAt(string cerLocation, string withPassword) | |
{ | |
var directory = Path.GetDirectoryName(cerLocation); | |
var fileName = Path.GetFileNameWithoutExtension(cerLocation); | |
X509Certificate cert = new X509Certificate(cerLocation); | |
byte[] certData = cert.Export(X509ContentType.Pkcs12, withPassword); | |
System.IO.File.WriteAllBytes(directory + @"\" + fileName + ".pfx", certData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment