Skip to content

Commit 3876203

Browse files
authored
Change to use the new method added to BCL (#481)
1 parent 1814b31 commit 3876203

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

AppService.Acmebot/Functions/SharedActivity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ public async Task CheckIsReady([ActivityTrigger] (OrderDetails, IReadOnlyList<Ac
589589
}
590590

591591
// 全てのエラーが connection か dns 関係の場合は Orchestrator からリトライさせる
592-
if (problems.All(x => x.Type == "urn:ietf:params:acme:error:connection" || x.Type == "urn:ietf:params:acme:error:dns"))
592+
if (problems.All(x => x.Type is "urn:ietf:params:acme:error:connection" or "urn:ietf:params:acme:error:dns"))
593593
{
594594
throw new RetriableOrchestratorException("ACME validation status is invalid, but retriable error. It will retry automatically.");
595595
}

AppService.Acmebot/Internal/AcmeProtocolClientFactory.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,13 @@ byte[] HmacSignature(byte[] x)
106106
{
107107
var hmacKeyBytes = CryptoHelper.Base64.UrlDecode(_options.ExternalAccountBinding.HmacKey);
108108

109-
var hmac = (HMAC)(_options.ExternalAccountBinding.Algorithm switch
109+
return _options.ExternalAccountBinding.Algorithm switch
110110
{
111-
"HS256" => new HMACSHA256(hmacKeyBytes),
112-
"HS384" => new HMACSHA384(hmacKeyBytes),
113-
"HS512" => new HMACSHA512(hmacKeyBytes),
111+
"HS256" => HMACSHA256.HashData(hmacKeyBytes, x),
112+
"HS384" => HMACSHA384.HashData(hmacKeyBytes, x),
113+
"HS512" => HMACSHA512.HashData(hmacKeyBytes, x),
114114
_ => throw new NotSupportedException($"The signature algorithm {_options.ExternalAccountBinding.Algorithm} is not supported. (supported values are HS256 / HS384 / HS512)")
115-
});
116-
117-
return hmac.ComputeHash(x);
115+
};
118116
}
119117

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

0 commit comments

Comments
 (0)