Skip to content

Commit

Permalink
Change to use the new method added to BCL (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
shibayan authored Jan 11, 2025
1 parent 1814b31 commit 3876203
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion AppService.Acmebot/Functions/SharedActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public async Task CheckIsReady([ActivityTrigger] (OrderDetails, IReadOnlyList<Ac
}

// 全てのエラーが connection か dns 関係の場合は Orchestrator からリトライさせる
if (problems.All(x => x.Type == "urn:ietf:params:acme:error:connection" || x.Type == "urn:ietf:params:acme:error:dns"))
if (problems.All(x => x.Type is "urn:ietf:params:acme:error:connection" or "urn:ietf:params:acme:error:dns"))
{
throw new RetriableOrchestratorException("ACME validation status is invalid, but retriable error. It will retry automatically.");
}
Expand Down
12 changes: 5 additions & 7 deletions AppService.Acmebot/Internal/AcmeProtocolClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,13 @@ byte[] HmacSignature(byte[] x)
{
var hmacKeyBytes = CryptoHelper.Base64.UrlDecode(_options.ExternalAccountBinding.HmacKey);

var hmac = (HMAC)(_options.ExternalAccountBinding.Algorithm switch
return _options.ExternalAccountBinding.Algorithm switch
{
"HS256" => new HMACSHA256(hmacKeyBytes),
"HS384" => new HMACSHA384(hmacKeyBytes),
"HS512" => new HMACSHA512(hmacKeyBytes),
"HS256" => HMACSHA256.HashData(hmacKeyBytes, x),
"HS384" => HMACSHA384.HashData(hmacKeyBytes, x),
"HS512" => HMACSHA512.HashData(hmacKeyBytes, x),
_ => throw new NotSupportedException($"The signature algorithm {_options.ExternalAccountBinding.Algorithm} is not supported. (supported values are HS256 / HS384 / HS512)")
});

return hmac.ComputeHash(x);
};
}

var payload = JsonConvert.SerializeObject(acmeProtocolClient.Signer.ExportJwk());
Expand Down

0 comments on commit 3876203

Please sign in to comment.