How to pass SSL certificate to Nowin when using Nancy


Mengers Pang

So I use Nancy with Nowin .

The nice thing about using Nowin is that I don't have to mess around with various Windows commands to set up a simple web server. According to the Nowin README, I can configure SSL using the following line of code

builder.SetCertificate(new X509Certificate2("certificate.pfx", "password"));

However, when using Nancy, I don't seem to have access to this server builder class. Everything seems to be happening magically behind the scenes.

Any ideas how to pass the certificate to Nowin?

Darryl
  1. Make sure the Nancy.Owin package is installed.

  2. Start the server with the following code:

using System;
using System.Net;
using System.Threading.Tasks;
using Nancy.Owin;
using Nowin;

public class Program
{
    static void Main(string[] args)
    {
        var myNancyAppFunc = NancyMiddleware.UseNancy()(NancyOptions options =>
        {
            // Modify Nancy options if desired;

            return Task.FromResult(0);
        });

        using (var server = ServerBuilder.New()
            .SetOwinApp(myNancyAppFunc)
            .SetEndPoint(new IPEndPoint(IPAddress.Any, 8080))
            .SetCertificate(new X509Certificate2("certificate.pfx", "password"))
            .Build()
        )
        {
            server.Start();

            Console.WriteLine("Running on 8080");
            Console.ReadLine();
        }
    }
}

Related


How to pass SSL certificate to Nowin when using Nancy

Mengers Pang So I use Nancy with Nowin . The nice thing about using Nowin is that I don't have to mess around with various Windows commands to set up a simple web server. According to the Nowin README, I can configure SSL using the following line of code build

How to pass SSL certificate to Nowin when using Nancy

Mengers Pang So I use Nancy with Nowin . The nice thing about using Nowin is that I don't have to mess around with various Windows commands to set up a simple web server. According to the Nowin README, I can configure SSL using the following line of code build

How to implement SSL certificate pinning when using React Native

Amr Draz: I need to implement SSL certificate pinning in my native application. I know very little about SSL/TLS, let alone pinning. I'm not a native mobile developer either, although I know Java and learned Objective-C on this project enough to solve the prob

How to implement SSL certificate pinning when using React Native

Amr Draz: I need to implement SSL certificate pinning in my native application. I know very little about SSL/TLS, let alone pinning. I'm not a native mobile developer either, although I know Java and learned Objective-C on this project enough to solve the prob

How to implement SSL certificate pinning when using React Native

Amr Draz: I need to implement SSL certificate pinning in my native application. I know very little about SSL/TLS, let alone pinning. I'm not a native mobile developer either, although I know Java and learned Objective-C on this project enough to solve the prob

SSL certificate for proxy pass?

stackoverflow_asker Let's say the user opens https://ssl-site.example/link/index.phpmy config in my server ProxyPassand ProxyPassReversein the apache config ( conf.dregion): ProxyPass "/link" "https://other-site.example/link" ProxyPassReverse "/link" "https://

How to ignore certificate check when ssl

Wang Qiao I'm trying to find a way to ignore certificate checking when requesting Https resources, so far I've found some useful articles on the Internet. But I still have some questions. Please check my code. I just don't understand what the code ServicePoint

How to ignore certificate check when ssl

Wang Qiao I'm trying to find a way to ignore certificate checking when requesting Https resources, so far I've found some useful articles on the Internet. But I still have some questions. Please check my code. I just don't understand what the code ServicePoint

How to ignore certificate check when ssl

Wang Qiao I'm trying to find a way to ignore certificate checking when requesting Https resources, so far I've found some useful articles on the Internet. But I still have some questions. Please check my code. I just don't understand what the code ServicePoint

How to enable ssl in NGINX using Goddady certificate?

Luke DS I'm pretty new to this and haven't installed an SSL certificate in nginx, so please excuse my ignorance. I have a certificate from Godaddy, but I can't seem to find a way to use it on my linux server (ubuntu 18.04). I will do what I have done so far. G

How to verify SSL certificate using C#

healy25 Maybe one of you can help me answer my question about validating certificates in .NET framework. Unfortunately, during my internet research, I've only come up with superficial answers to questions without exact explanations. At the same time, I know th

How to verify SSL certificate using C#

healy25 Maybe one of you can help me answer my question about validating certificates in .NET framework. Unfortunately, during my internet research, I've only come up with superficial answers to questions without exact explanations. At the same time, I know th

How to pass SSL certificate via GET REST API call

javaMan I have a web server running on other computer. I am able to use the postman client and load the cert.pem and key.pem files and execute the get request successfully. Now I want to do this programmatically in Java. To do this, I add PKCS12 to the keystor

How to pass SSL certificate via GET REST API call

javaMan I have a web server running on other computer. I am able to use the postman client and load the cert.pem and key.pem files and execute the get request successfully. Now I want to do this programmatically in Java. To do this, I add PKCS12 to the keystor

How to pass SSL certificate via GET REST API call

javaMan I have a web server running on other computer. I am able to use the postman client and load the cert.pem and key.pem files and execute the get request successfully. Now I want to do this programmatically in Java. To do this, I add PKCS12 to the keystor

How to pass SSL certificate via GET REST API call

javaMan I have a web server running on other computer. I am able to use the postman client and load the cert.pem and key.pem files and execute the get request successfully. Now I want to do this programmatically in Java. To do this, I add PKCS12 to the keystor