/// <summary>
        /// Request a new certificate
        /// </summary>
        /// <param name="account">Existing account</param>
        /// <param name="certificate">Info describing the dns entries you are requesting certificates for.</param>
        /// <returns>A certificate fulfillment promise that is used to complete the certification chain in future requests.</returns>
        public async Task <AcmeCertificateFulfillmentPromise> RequestCertificateAsync(AcmeAccount account, AcmeCertificateRequest certificate)
        {
            var directory = await _directoryCache.GetAsync();

            var nonce = await _nonceCache.GetAsync();

            var response = await _acmeApi.RequestCertificateAsync(directory, nonce, account, certificate);

            if (response.Status == AcmeApiResponseStatus.Error)
            {
                throw new AcmeProtocolException(response.Message);
            }

            _nonceCache.Update(response.Nonce);

            return(response.Data);
        }
        /// <summary>
        /// Create a new account.
        /// </summary>
        /// <param name="accountDetails">Information for new account.</param>
        /// <returns>Returns a serializable account object.</returns>
        public async Task <AcmeAccount> CreateAsync(AcmeCreateAccount accountDetails)
        {
            var directory = await _directoryCache.GetAsync();

            var nonce = await _nonceCache.GetAsync();

            var response = await _acmeApi.CreateAccountAsync(directory, nonce, accountDetails);

            if (response.Status == AcmeApiResponseStatus.Error)
            {
                throw new AcmeProtocolException(response.Message);
            }

            _nonceCache.Update(response.Nonce);

            return(response.Data);
        }
Example #3
0
        /// <summary>
        /// Tells the Acme server to start the verification process for the challenge
        /// </summary>
        /// <param name="challenge">The challenge to start the verification process for</param>
        /// <returns>The challenge status.</returns>
        public async Task <AcmeChallengeStatus> ExecuteChallengeVerification(IAcmeChallengeContent challenge)
        {
            var nonce = await _nonceCache.GetAsync();

            var response = await _acmeApi.VerifyChallengeAsync(challenge.Account, challenge.Challenge, nonce, challenge.AuthorizationKey);

            if (response.Status == AcmeApiResponseStatus.Error)
            {
                throw new AcmeProtocolException(response.Message);
            }

            _nonceCache.Update(response.Nonce);

            return(response.Data);
        }
 public void UpdateProperty(Property property)
 {
     _repository.Update(property);
 }