public void TestPfxFromPem() { BindingRedirectHandler.DoBindingRedirects(AppDomain.CurrentDomain); string pfxFilePath = Path.GetTempPath() + "ssl-pfx-test-" + Guid.NewGuid() + ".pfx"; string certificatePassword = null; string crtFilePath = UtilsSystem.GetResourceFileAsPath("certificate_files_example\\a0e8efb7cca4452ed304b1d9614ec89d-crt.pem"); string keyFilePath = UtilsSystem.GetResourceFileAsPath("certificate_files_example\\a0e8efb7cca4452ed304b1d9614ec89d-key.pem"); UtilsCertificate.CreatePfXfromPem(crtFilePath, keyFilePath, pfxFilePath, certificatePassword); // Make sure that the certificate file is valid and works X509Certificate2Collection collection = new X509Certificate2Collection(); collection.Import(pfxFilePath, certificatePassword, X509KeyStorageFlags.EphemeralKeySet); var originalCert = collection[0]; Assert.Equal("033679B39C0CDA50C745ABD173FB0DD381A1", originalCert.SerialNumber); File.Delete(pfxFilePath); }
public ChefTestFixture() { BindingRedirectHandler.DoBindingRedirects(AppDomain.CurrentDomain); }