示例#1
0
        private string GetChalangeDnsText(Account account, string token)
        {
            var key    = GetChalangeKey(account, token);
            var hashed = Sha256HashProvider.ComputeHash(Encoding.UTF8.GetBytes(key));

            return(JwsConvert.ToBase64String(hashed));
        }
示例#2
0
        //

        //private async Task<Authorization> DeactivateChallengeAsync(Uri location)
        //{
        //    var auth = new Authorization { Status = AuthorizationStatus.Deactivated };
        //    var signedData = _jws.Sign(auth, location, location, Nonce);
        //    return await PostAsync<Authorization>(location, signedData);
        //}

        private string GetChalangeKey(Account account, string token)
        {
            var jwkJson              = JsonConvert.SerializeObject(account.Key.Jwk, Formatting.None, _jsonSettings);
            var jwkBytes             = Encoding.UTF8.GetBytes(jwkJson);
            var jwkThumbprint        = Sha256HashProvider.ComputeHash(jwkBytes);
            var jwkThumbprintEncoded = JwsConvert.ToBase64String(jwkThumbprint);

            return($"{token}.{jwkThumbprintEncoded}");
        }