Exemple #1
0
        public void CanCreatePfxWithoutChain(KeyAlgorithm alog)
        {
            var leafCert = File.ReadAllText("./Data/leaf-cert.pem");

            var pfxBuilder = new PfxBuilder(
                Encoding.UTF8.GetBytes(leafCert), KeyFactory.NewKey(alog));

            pfxBuilder.FullChain = false;
            var pfx = pfxBuilder.Build("my-cert", "abcd1234");
        }
Exemple #2
0
        public async Task CanCreatePfxChain(KeyAlgorithm alog)
        {
            var(cert, key) = await Helper.GetValidCert();

            var pfxBuilder = new PfxBuilder(
                Encoding.UTF8.GetBytes(cert), KeyFactory.NewKey(alog));

            pfxBuilder.AddIssuers(Encoding.UTF8.GetBytes(cert));
            var pfx = pfxBuilder.Build("my-cert", "abcd1234");
        }
        public void FailChainForExpiredCert(KeyAlgorithm alog)
        {
            var leafCert = File.ReadAllBytes("./Data/leaf-cert-expire.cer");

            var pfxBuilder = new PfxBuilder(leafCert, KeyFactory.NewKey(alog));

            pfxBuilder.AddIssuer(File.ReadAllBytes("./Data/test-ca2.pem"));
            pfxBuilder.AddIssuer(File.ReadAllBytes("./Data/test-root.pem"));
            Assert.Throws <PkixCertPathBuilderException>(() => pfxBuilder.Build("my-cert", "abcd1234"));
        }
        public void CanCreatePfxChain(KeyAlgorithm alog)
        {
            var leafCert = File.ReadAllText("./Data/leaf-cert.pem");

            var pfxBuilder = new PfxBuilder(
                Encoding.UTF8.GetBytes(leafCert), KeyFactory.NewKey(alog));

            pfxBuilder.AddIssuer(File.ReadAllBytes("./Data/test-ca2.pem"));
            pfxBuilder.AddIssuer(File.ReadAllBytes("./Data/test-root.pem"));
            var pfx = pfxBuilder.Build("my-cert", "abcd1234");
        }