public async Task Should_convert_der_to_pem()
        {
            var der = await File.ReadAllBytesAsync("Content\\ca_root.crt");

            var expected = await File.ReadAllTextAsync("Content\\ca_root.pem");

            var pem = X509Convert.ConvertToPem(der);

            AssertExt.Equal(expected, pem);
        }
Exemple #2
0
        public async Task Should_build_the_certificate_chain_when_root()
        {
            var caRoot = await File.ReadAllTextAsync("Content\\ca_root.pem");

            var expected = caRoot;

            var client = new HttpClient();
            var x509   = new X509ChainComposer(client);
            var result = await x509.ComposeChain(caRoot);

            AssertExt.Equal(expected, result.ToPem());
        }
Exemple #3
0
        public async Task Should_build_the_certificate_chain_when_intermediate()
        {
            var caInt = await File.ReadAllTextAsync("Content\\ca_int.pem");

            var caRoot = await File.ReadAllTextAsync("Content\\ca_root.pem");

            var expected = await File.ReadAllTextAsync("Content\\chain_int_root.pem");

            var handler = new HttpMessageHandlerStub();

            handler.AddRequestResponse("http://trust.quovadisglobal.com/qvrca2g3.crt", caRoot);

            var client = new HttpClient(handler);

            var x509   = new X509ChainComposer(client);
            var result = await x509.ComposeChain(caInt);

            AssertExt.Equal(expected, result.ToPem());
        }