Example #1
0
        public void Init()
        {
            if (RootUrl == null)
            {
                throw new InvalidOperationException("Missing ACME server root URL (RootUrl)");
            }

            if (Signer == null)
            {
                throw new InvalidOperationException("Missing request message signer (Signer)");
            }

            if (Directory == null)
            {
                Directory = new AcmeServerDirectory();
            }

            // TODO:  according to ACME 5.5 we *should* be able to issue a HEAD
            // request to get an initial replay-nonce, but this is not working,
            // so we do a GET against the root URL to get that initial nonce
            //requ.Method = AcmeProtocol.HTTP_METHOD_HEAD;

            var requUri = new Uri(RootUrl, Directory[AcmeServerDirectory.RES_INIT]);
            var resp    = RequestHttpGet(requUri);

            Initialized = true;
        }
Example #2
0
        public AcmeClient(Uri rootUrl    = null, AcmeServerDirectory dir = null,
                          ISigner signer = null, AcmeRegistration reg    = null)
        {
            RootUrl      = rootUrl;
            Directory    = dir;
            Signer       = signer;
            Registration = reg;

            UserAgent = string.Format(AcmeProtocol.HTTP_USER_AGENT_FMT,
                                      this.GetType().Assembly.GetName().Version);
        }