Certes 2.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Certes --version 2.2.2
NuGet\Install-Package Certes -Version 2.2.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Certes" Version="2.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Certes --version 2.2.2
#r "nuget: Certes, 2.2.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Certes as a Cake Addin
#addin nuget:?package=Certes&version=2.2.2

// Install Certes as a Cake Tool
#tool nuget:?package=Certes&version=2.2.2

Certes

Certes is an ACME client runs on .NET 4.5+ and .NET Standard 1.3+, supports ACME v2 and wildcard certificates. It is aimed to provide an easy to use API for managing certificates during deployment processes.

Usage

Install Certes nuget package into your project:

Install-Package Certes

or using .NET CLI:

dotnet add package Certes

Let's Encrypt is the primary CA we supported. It's recommend testing against staging environment before using production environment, to avoid hitting the rate limits.

Account

Creating new ACME account:

var acme = new AcmeContext(WellKnownServers.LetsEncryptStagingV2);
var account = acme.NewAccount("admin@example.com", true);

// Save the account key for later use
var pemKey = acme.AccountKey.ToPem();

Use an existing ACME account:

// Load the saved account key
var accountKey = KeyFactory.FromPem(pemKey);
var acme = new AcmeContext(WellKnownServers.LetsEncryptStagingV2, accountKey);
var account = acme.Account();

See API doc for additional operations.

Order

Place a wildcard certificate order (DNS validation is required for wildcard certificates)

var order = await acme.NewOrder(new[] { "*.your.domain.name" });

Generate the value for DNS TXT record

var authz = (await order.Authorizations()).First();
var dnsChallenge = await authz.Dns();
var dnsTxt = acme.AccountKey.DnsTxt(dnsChallenge.Token);

Add a DNS TXT record to _acme-challenge.your.domain.name with dnsTxt value.

For non-wildcard certificate, HTTP challenge is also available

var order = await acme.NewOrder(new[] { "your.domain.name" });

Authorization

Get the token and key authorization string

var authz = (await order.Authorizations()).First();
var httpChallenge = await authz.Http();
var keyAuthz = httpChallenge.KeyAuthz;

Save the key authorization string in a text file, and upload it to http://your.domain.name/.well-known/acme-challenge/<token>

Validate

Ask the ACME server to validate our domain ownership

await challenge.Validate();

Certificate

Download the certificate once validation is done

var privateKey = KeyFactory.NewKey(KeyAlgorithm.ES256);
var cert = await order.Generate(new CsrInfo
{
    CountryName = "CA",
    State = "Ontario",
    Locality = "Toronto",
    Organization = "Certes",
    OrganizationUnit = "Dev",
    CommonName = "your.domain.name",
}, privateKey);

Export full chain certification

var certPem = cert.ToPem();

Export PFX

var pfxBuilder = cert.ToPfx(privateKey);
var pfx = pfxBuilder.Build("my-cert", "abcd1234");

Check the APIs for more details.

For ACME v1, please see the doc here.

CLI

The CLI is available as a dotnet global tool. .NET Core Runtime 2.1+ is required to use dotnet tools.

To install Certes CLI (you may need to restart the console session if this is the first dotnet tool installed)

dotnet tool install --global dotnet-certes

Use the --help option to get started

certes --help

or check this AppVeyor script for renewing certificates on Azure apps.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Also check the changelog to see what's we are working on.

CI Status

NuGet NuGet NuGet NuGet

AppVeyor AppVeyor codecov BCH compliance

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (28)

Showing the top 5 NuGet packages that depend on Certes:

Package Downloads
LettuceEncrypt

Provides API for configuring ASP.NET Core to automatically generate HTTPS certificates. This configures your server to use the ACME protocol to connect with a certificate authority (CA), such as Let's Encrypt (https://letsencrypt.org), to verify ownership of your domain name and generate a HTTPS certificate. This happens automatically when the server starts up, and will renew the certificate automatically when the expiration date is near. This only works with Kestrel, which is the default server configuration for ASP.NET Core projects. Other servers, such as IIS and nginx, are not supported.

FluffySpoon.AspNet.LetsEncrypt The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Package Description

LagoVista.Net.LetsEncrypt

Provides Middleware and services to request and store certificates from the Let's Encrypt service for ASP.NET Core applications

ZC.Middleware.DefaultAPI

Package Description

TecWare.DES.Module.ACME

ACME wrapper for the data exchange server.

GitHub repositories (8)

Showing the top 5 popular GitHub repositories that depend on Certes:

Repository Stars
natemcmaster/LettuceEncrypt
Free, automatic HTTPS certificate generation for ASP.NET Core web apps
sjkp/letsencrypt-siteextension
Azure Web App Site Extension for easy installation and configuration of Let's Encrypt issued SSL certifcates for custom domain names.
Maarten88/rrod
Exploring a new web architecture with React, Redux, Orleans and Dotnet Core
ffMathy/FluffySpoon.AspNet.EncryptWeMust
junkai-li/NetCoreKevin
基于NET6搭建跨平台DDD-微服务-WebApi架构支持:IDS4单点登录、多缓存、自动任务、分布式、多租户、日志、授权和鉴权、CAP集成事件、SignalR、领域事件、单元测试
Version Downloads Last updated
3.0.4 167,648 1/4/2023
3.0.3 213,789 10/4/2021
3.0.0 113,237 7/18/2021
2.3.4 361,791 3/27/2020
2.3.3 354,202 12/17/2018
2.3.2 65,375 10/20/2018
2.3.1 1,817 10/16/2018
2.3.0 19,064 6/15/2018
2.2.2 2,348 5/31/2018
2.2.1 2,373 5/15/2018
2.2.0 3,114 5/5/2018
2.1.0 2,184 4/28/2018
2.0.1 2,942 3/17/2018
2.0.0 2,181 3/13/2018
1.1.4 2,881 3/4/2018
1.1.3 8,172 11/23/2017
1.1.2 3,908 9/28/2017
1.1.0 3,738 8/17/2017
1.0.7 8,904 7/20/2017
1.0.6.202 3,389 4/4/2017
1.0.5.191 2,157 3/29/2017
1.0.4.178 2,105 3/29/2017
1.0.3.139 2,156 12/22/2016
1.0.2.108 2,253 7/13/2016
1.0.1.64 2,239 7/6/2016
1.0.0.55 2,362 7/6/2016