Ejemplo n.º 1
0
        public AccountDetails(ACMESharp.Protocol.AccountDetails accountDetails, IJwsTool clientSigner)
        {
            Kid     = accountDetails.Kid;
            TosLink = accountDetails.TosLink;

            Account accountPayload = accountDetails.Payload;

            if (null == accountPayload)
            {
                throw new ArgumentNullException("accountDetails.Payload");
            }

            Id      = accountPayload.Id;
            Contact = accountPayload.Contact;
            // test server returns testing in status
            if (Enum.TryParse <AccountStatus>(accountPayload.Status, true, out AccountStatus accountStatus))
            {
                Status = accountStatus;
            }

            TermsOfServiceAgreed = accountPayload.TermsOfServiceAgreed ?? false;
            OrdersUrl            = accountPayload.Orders;
            InitialIp            = accountPayload.InitialIp;
            CreatedAt            = accountPayload.CreatedAt;
            Agreement            = accountPayload.Agreement;

            KeyType   = clientSigner.JwsAlg;
            KeyExport = clientSigner.Export();
        }
Ejemplo n.º 2
0
        private void Init(HttpClient http, ServiceDirectory dir,
                          AccountDetails acct, IJwsTool signer,
                          ILogger logger)
        {
            _http     = http;
            Directory = dir ?? new ServiceDirectory();

            Account = acct;

            // We default to ES256 signer
            if (signer == null)
            {
                signer = new Crypto.JOSE.Impl.ESJwsTool();
                signer.Init();
            }
            Signer = signer;

            _log = logger ?? NullLogger.Instance;
            _log.LogInformation("ACME client initialized");
        }