ebekker / ACMESharp

An ACME client library and PowerShell client for the .NET platform (Let's Encrypt)
https://pkisharp.github.io/ACMESharp-docs/
1.21k stars 184 forks source link

Is there a .Net Core version of this library? #328

Open ericallenpaul opened 6 years ago

ericallenpaul commented 6 years ago

Is there a .net core version of this library?

webprofusion-chrisc commented 6 years ago

Not currently but if you're targeting .net standard 2.0 you'd probably be able to reference the core dll's OK. Failing that there are other alternatives such as certes (which targets several runtimes).

ericallenpaul commented 6 years ago

Thanks for the reply

pksorensen commented 6 years ago

I tested this, but it parses the links for TOS wrong when using netstandard2.0

image

resulting in

ACMESharp.AcmeClient+AcmeWebException: Unexpected error
 +Response from server:
    + Code: BadRequest
    + Content: {
  "type": "urn:acme:error:malformed",
  "detail": "Provided agreement URL [https://acme-v01.api.letsencrypt.org/acme/new-authz\u003e;rel=\"next\", \u003chttps://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf] does not match current agreement URL [https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf]",
  "status": 400
} ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at ACMESharp.AcmeClient.RequestHttpPost(Uri uri, Object message)
   --- End of inner exception stack trace ---
   at ACMESharp.AcmeClient.UpdateRegistration(Boolean useRootUrl, Boolean agreeToTos, String[] contacts)
   at SInnovations.LetsEncrypt.Services.Defaults.DefaultAcmeClientService.<>c__DisplayClass11_0.<<CreateClientAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SInnovations.LetsEncrypt.Services.Defaults.DefaultAcmeClientService.<CreateClientAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SInnovations.LetsEncrypt.LetsEncryptService.<GenerateCertPairAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SInnovations.ServiceFabric.GatewayService.Actors.GatewayServiceManagerActor.<HandleDnsChallengeAsync>d__14.MoveNext() in C:\agent\_work\3\s\apps\S-Innovations.ServiceFabric.GatewayService\Actors\GatewayServiceManagerActor.cs:line 179
ericallenpaul commented 6 years ago

I am using Certes now and it's working quite well with my .Net core project. It may work as well in .Net Standard 2. The AcmeSharp library works well in .Net Framework but there were just too many issues for me to make it work in .Net core. Of course I'm still a noob in .net core and .net standard.

pksorensen commented 6 years ago

I switched to certes also yesterday instead of making it work. Its nice and the dependency graph is also more clean.