Embed private key with the test X.509 certificate
- Use the PKCS #12 certificate format to enable this
This commit is contained in:
parent
0844369f5f
commit
8fc8307ad2
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Dnx.Runtime;
|
||||||
|
|
||||||
#if DNX451
|
#if DNX451
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -16,7 +17,7 @@ namespace SampleApp
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IApplicationEnvironment env)
|
||||||
{
|
{
|
||||||
loggerFactory.MinimumLevel = LogLevel.Debug;
|
loggerFactory.MinimumLevel = LogLevel.Debug;
|
||||||
|
|
||||||
|
|
@ -24,12 +25,12 @@ namespace SampleApp
|
||||||
|
|
||||||
#if DNX451
|
#if DNX451
|
||||||
var testCertPath = Path.Combine(
|
var testCertPath = Path.Combine(
|
||||||
Environment.CurrentDirectory,
|
env.ApplicationBasePath,
|
||||||
@"../../test/Microsoft.AspNet.Server.KestrelTests/TestResources/testCert.cer");
|
@"../../test/Microsoft.AspNet.Server.KestrelTests/TestResources/testCert.pfx");
|
||||||
|
|
||||||
if (File.Exists(testCertPath))
|
if (File.Exists(testCertPath))
|
||||||
{
|
{
|
||||||
app.UseKestrelHttps(new X509Certificate2(testCertPath));
|
app.UseKestrelHttps(new X509Certificate2(testCertPath, "testPassword"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
|
||||||
var sereverAddress = "https://localhost:54321/";
|
var sereverAddress = "https://localhost:54321/";
|
||||||
var serviceContext = new TestServiceContext()
|
var serviceContext = new TestServiceContext()
|
||||||
{
|
{
|
||||||
ConnectionFilter = new HttpsConnectionFilter(new X509Certificate2(@"TestResources/testCert.cer"), new NoOpConnectionFilter())
|
ConnectionFilter = new HttpsConnectionFilter(
|
||||||
|
new X509Certificate2(@"TestResources/testCert.pfx", "testPassword"),
|
||||||
|
new NoOpConnectionFilter())
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var server = new TestServer(App, serviceContext, sereverAddress))
|
using (var server = new TestServer(App, serviceContext, sereverAddress))
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue