Esempio n. 1
0
        private async Task CreateNewLetsEncryptAccount()
        {
            _logger.LogDebug("Creating LetsEncrypt account with email {0}.", _options.Email);

            acme = new AcmeContext(LetsEncryptUri);
            await acme.NewAccount(_options.Email, true);

            await _persistenceService.PersistAccountCertificateAsync(acme.AccountKey);
        }
Esempio n. 2
0
        public async Task <IKey> AuthenticateWithNewAccount(
            string email,
            Uri acmeServer,
            bool termsOfServiceAgreed,
            CancellationToken cancellationToken)
        {
            _logger.LogDebug("Acme authenticating and creating Let's Encrypt account with email {email}...", email);

            cancellationToken.ThrowIfCancellationRequested();

            if (_acmeContext != null)
            {
                return(_acmeContext.AccountKey);
            }

            _acmeContext = new AcmeContext(acmeServer);
            await _acmeContext.NewAccount(email, true);

            return(_acmeContext.AccountKey);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates an account.
 /// </summary>
 /// <param name="context">The ACME context.</param>
 /// <param name="email">The email.</param>
 /// <param name="termsOfServiceAgreed">Set to <c>true</c> to accept the terms of service.</param>
 /// <param name="eabKeyId">Optional key identifier for external account binding</param>
 /// <param name="eabKey">Optional key for use with external account binding</param>
 /// <param name="eabKeyAlg">Optional key algorithm e.g HS256, for external account binding</param>
 /// <returns>
 /// The account created.
 /// </returns>
 public static Task <IAccountContext> NewAccount(this IAcmeContext context, string email, bool termsOfServiceAgreed = false, string eabKeyId = null, string eabKey = null, string eabKeyAlg = null)
 => context.NewAccount(new[] { $"mailto:{email}" }, termsOfServiceAgreed, eabKeyId, eabKey, eabKeyAlg);
Esempio n. 4
0
 /// <summary>
 /// Creates an account.
 /// </summary>
 /// <param name="context">The ACME context.</param>
 /// <param name="email">The email.</param>
 /// <param name="termsOfServiceAgreed">Set to <c>true</c> to accept the terms of service.</param>
 /// <returns>
 /// The account created.
 /// </returns>
 public static Task <IAccountContext> NewAccount(this IAcmeContext context, string email, bool termsOfServiceAgreed = false)
 => context.NewAccount(new[] { $"mailto:{email}" }, termsOfServiceAgreed);
Esempio n. 5
0
 public async Task Login(string email)
 {
     await _acme.NewAccount(email, true);
 }