Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to use the new method added to BCL #481

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading