ACMESharp.AcmeClient.ExtractNonce C# (CSharp) Method

ExtractNonce() private method

Extracts the next ACME protocol nonce from the argument Web response and remembers it for the next protocol request.
private ExtractNonce ( WebResponse resp ) : void
resp System.Net.WebResponse
return void
        private void ExtractNonce(WebResponse resp)
        {
            var nonceHeader = resp.Headers.AllKeys.FirstOrDefault(x =>
                    x.Equals(AcmeProtocol.HEADER_REPLAY_NONCE, StringComparison.OrdinalIgnoreCase));
            if (string.IsNullOrEmpty(nonceHeader))
                throw new AcmeException("Missing initial replay-nonce header");

            NextNonce = resp.Headers[nonceHeader];
            if (string.IsNullOrEmpty(NextNonce))
                throw new AcmeException("Missing initial replay-nonce header value");
        }