diff --git a/v2.0/LetsEncrypt/App.cs b/v2.0/LetsEncrypt/App.cs index b26c86b..30cdf27 100644 --- a/v2.0/LetsEncrypt/App.cs +++ b/v2.0/LetsEncrypt/App.cs @@ -1,13 +1,16 @@ using System; using System.IO; +using System.Linq; + +using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; -using System.Linq; + using Microsoft.Extensions.Options; -using Mono.Unix; + using LetsEncrypt.Services; using LetsEncrypt.Helpers; @@ -32,7 +35,7 @@ namespace LetsEncrypt } public void Run() { - _appSettings.environments.Where(env => env.active).ToList().ForEach(env => { + foreach(var env in _appSettings.environments.Where(env => env.active)) { try { Console.WriteLine(string.Format("Let's Encrypt C# .Net Core Client, environment: {0}", env.name)); @@ -189,10 +192,9 @@ namespace LetsEncrypt } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); + break; } - }); - - + } } } } diff --git a/v2.0/LetsEncrypt/Entities/LetsEncrypt/Jwk.cs b/v2.0/LetsEncrypt/Entities/LetsEncrypt/Jwk.cs index ef132df..c941659 100644 --- a/v2.0/LetsEncrypt/Entities/LetsEncrypt/Jwk.cs +++ b/v2.0/LetsEncrypt/Entities/LetsEncrypt/Jwk.cs @@ -1,10 +1,12 @@ +// https://tools.ietf.org/html/rfc7517 + using System; using Newtonsoft.Json; namespace LetsEncrypt.Entities { - public class Jwk + public class Jwk { /// /// "kty" (Key Type) Parameter diff --git a/v2.0/LetsEncrypt/Services/JwsService.cs b/v2.0/LetsEncrypt/Services/JwsService.cs index 859ab00..b7d23e6 100644 --- a/v2.0/LetsEncrypt/Services/JwsService.cs +++ b/v2.0/LetsEncrypt/Services/JwsService.cs @@ -1,4 +1,9 @@ -using System; +/** +* https://tools.ietf.org/html/rfc4648 +* https://tools.ietf.org/html/rfc4648#section-5 +*/ + +using System; using System.Security.Cryptography; using System.Text; using Newtonsoft.Json; @@ -31,8 +36,7 @@ namespace LetsEncrypt.Services var publicParameters = rsa.ExportParameters(false); - _jwk = new Jwk - { + _jwk = new Jwk () { KeyType = "RSA", Exponent = Base64UrlEncoded(publicParameters.Exponent), Modulus = Base64UrlEncoded(publicParameters.Modulus), @@ -112,6 +116,7 @@ namespace LetsEncrypt.Services return Base64UrlEncoded(Encoding.UTF8.GetBytes(s)); } + // https://tools.ietf.org/html/rfc4648#section-5 public string Base64UrlEncoded(byte[] arg) { var s = Convert.ToBase64String(arg); // Regular base64 encoder diff --git a/v2.0/LetsEncrypt/Services/LetsEncryptService.cs b/v2.0/LetsEncrypt/Services/LetsEncryptService.cs index 43965bd..979f674 100644 --- a/v2.0/LetsEncrypt/Services/LetsEncryptService.cs +++ b/v2.0/LetsEncrypt/Services/LetsEncryptService.cs @@ -1,5 +1,4 @@ /** -* tools.itef.org/html/draft-itef-acme-acme-18 * https://community.letsencrypt.org/t/trying-to-do-post-as-get-but-getting-post-jws-not-signed/108371 * https://tools.ietf.org/html/rfc8555#section-6.2 * @@ -100,7 +99,6 @@ namespace LetsEncrypt.Services { // 1 - Get directory (_directory, _) = await SendAsync(HttpMethod.Get, new Uri("directory", UriKind.Relative), null, token); - if (File.Exists(_path)) { bool success; @@ -420,8 +418,7 @@ namespace LetsEncrypt.Services { /// /// /// - public async Task KeyChange(CancellationToken token = default(CancellationToken)) - { + public async Task KeyChange(CancellationToken token = default(CancellationToken)) { } @@ -431,8 +428,7 @@ namespace LetsEncrypt.Services { /// /// /// - public async Task RevokeCertificate(CancellationToken token = default(CancellationToken)) - { + public async Task RevokeCertificate(CancellationToken token = default(CancellationToken)) { }