ACMESharp.AcmeClient.SubmitChallengeAnswer C# (CSharp) Метод

SubmitChallengeAnswer() публичный Метод

public SubmitChallengeAnswer ( AuthorizationState authzState, string type, bool useRootUrl = false ) : AuthorizeChallenge
authzState AuthorizationState
type string
useRootUrl bool
Результат AuthorizeChallenge
        public AuthorizeChallenge SubmitChallengeAnswer(AuthorizationState authzState,
                string type, bool useRootUrl = false)
        {
            AssertInit();
            AssertRegistration();

            var authzChallenge = authzState.Challenges.FirstOrDefault(x => x.Type == type);
            if (authzChallenge == null)
                throw new ArgumentException("no challenge found matching requested type");

            if (authzChallenge.Challenge == null)
                throw new InvalidOperationException("challenge has not been decoded");
            if (authzChallenge.Challenge.Answer == null)
                throw new InvalidOperationException("challenge answer has not been generated");

            var requUri = new Uri(authzChallenge.Uri);
            if (useRootUrl)
                requUri = new Uri(RootUrl, requUri.PathAndQuery);

            var requ = ChallengeAnswerRequest.CreateRequest(authzChallenge.Challenge.Answer);
            var resp = RequestHttpPost(requUri, requ);

            if (resp.IsError)
            {
                throw new AcmeWebException(resp.Error as WebException,
                        "Unexpected error", resp);
            }

            authzChallenge.SubmitResponse = resp;
            authzChallenge.SubmitDate = DateTime.Now;

            return authzChallenge;
        }