//[Fact]
        public void Create_pfx()
        {
            // Arrange
            var keyManager = new FileKeyStore(Environment.CurrentDirectory);
            var key        = keyManager.GetOrCreateKey("test.startliste.info").ExportParameters(true);

            Pkcs12.CreatePfxFile(key, @"test.startliste.info.cer", "test", @"test.startliste.info.pfx");

            Assert.True(File.Exists(@"test.startliste.info.pfx"));
        }
Exemple #2
0
        private void SaveCertificateWithPrivateKey(string domain, RSAParameters key, string certificatePath)
        {
            Log.Info("generating pfx file with certificate and private key");

            GetPfxPasswordFromUser();

            try
            {
                var pfxPath = Path.Combine(this.options.StoreDirectory, $"{domain}.pfx");

                Pkcs12.CreatePfxFile(key, certificatePath, options.PfxPassword, pfxPath);

                Log.Info($"pfx file saved to {pfxPath}");
            }
            catch (Exception ex)
            {
                Log.Error("could not create pfx file: " + ex);
            }
        }