Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
md_acme.h File Reference

Go to the source code of this file.

Data Structures

struct  md_acme_t
 
struct  md_acme_req_t
 

Macros

#define MD_PROTO_ACME   "ACME"
 
#define MD_AUTHZ_CHA_HTTP_01   "http-01"
 
#define MD_AUTHZ_CHA_SNI_01   "tls-sni-01"
 
#define MD_ACME_VERSION_UNKNOWN   0x0
 
#define MD_ACME_VERSION_1   0x010000
 
#define MD_ACME_VERSION_2   0x020000
 
#define MD_ACME_VERSION_MAJOR(i)   (((i)&0xFF0000) >> 16)
 

Typedefs

typedef struct md_acme_t md_acme_t
 
typedef struct md_acme_req_t md_acme_req_t
 
typedef apr_status_t md_acme_req_res_cb (md_acme_t *acme, const struct md_http_response_t *res, void *baton)
 
typedef apr_status_t md_acme_req_init_cb (md_acme_req_t *req, void *baton)
 
typedef apr_status_t md_acme_req_json_cb (md_acme_t *acme, apr_pool_t *p, const apr_table_t *headers, struct md_json_t *jbody, void *baton)
 
typedef apr_status_t md_acme_req_err_cb (md_acme_req_t *req, const struct md_result_t *result, void *baton)
 
typedef apr_status_t md_acme_new_nonce_fn (md_acme_t *acme)
 
typedef apr_status_t md_acme_req_init_fn (md_acme_req_t *req, struct md_json_t *jpayload)
 
typedef apr_status_t md_acme_post_fn (md_acme_t *acme, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 

Enumerations

enum  md_acme_state_t {
  MD_ACME_S_UNKNOWN, MD_ACME_S_REGISTERED, MD_ACME_S_TOS_ACCEPTED, MD_ACME_S_CHALLENGED,
  MD_ACME_S_VALIDATED, MD_ACME_S_CERTIFIED, MD_ACME_S_DENIED
}
 

Functions

apr_status_t md_acme_init (apr_pool_t *pool, const char *base_version, int init_ssl)
 
apr_status_t md_acme_create (md_acme_t **pacme, apr_pool_t *p, const char *url, const char *proxy_url)
 
apr_status_t md_acme_setup (md_acme_t *acme, struct md_result_t *result)
 
void md_acme_report_result (md_acme_t *acme, apr_status_t rv, struct md_result_t *result)
 
void md_acme_clear_acct (md_acme_t *acme)
 
apr_status_t md_acme_POST_new_account (md_acme_t *acme, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 
const char * md_acme_acct_id_get (md_acme_t *acme)
 
const char * md_acme_acct_url_get (md_acme_t *acme)
 
apr_status_t md_acme_use_acct (md_acme_t *acme, struct md_store_t *store, apr_pool_t *p, const char *acct_id)
 
apr_status_t md_acme_agree (md_acme_t *acme, apr_pool_t *p, const char *tos)
 
apr_status_t md_acme_check_agreement (md_acme_t *acme, apr_pool_t *p, const char *agreement, const char **prequired)
 
apr_status_t md_acme_save_acct (md_acme_t *acme, apr_pool_t *p, struct md_store_t *store)
 
apr_status_t md_acme_acct_deactivate (md_acme_t *acme, apr_pool_t *p)
 
apr_status_t md_acme_req_body_init (md_acme_req_t *req, struct md_json_t *payload)
 
apr_status_t md_acme_GET (md_acme_t *acme, const char *url, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 
apr_status_t md_acme_POST (md_acme_t *acme, const char *url, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 
apr_status_t md_acme_get_json (struct md_json_t **pjson, md_acme_t *acme, const char *url, apr_pool_t *p)
 
apr_status_t md_acme_protos_add (struct apr_hash_t *protos, apr_pool_t *p)
 

Macro Definition Documentation

#define MD_ACME_VERSION_1   0x010000
#define MD_ACME_VERSION_2   0x020000
#define MD_ACME_VERSION_MAJOR (   i)    (((i)&0xFF0000) >> 16)
#define MD_ACME_VERSION_UNKNOWN   0x0
#define MD_AUTHZ_CHA_HTTP_01   "http-01"
#define MD_AUTHZ_CHA_SNI_01   "tls-sni-01"
#define MD_PROTO_ACME   "ACME"

Typedef Documentation

typedef apr_status_t md_acme_new_nonce_fn(md_acme_t *acme)
typedef apr_status_t md_acme_post_fn(md_acme_t *acme, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
typedef apr_status_t md_acme_req_err_cb(md_acme_req_t *req, const struct md_result_t *result, void *baton)

Request callback on detected errors.

typedef apr_status_t md_acme_req_init_cb(md_acme_req_t *req, void *baton)

Request callback to initialize before sending. May be invoked more than once in case of retries.

typedef apr_status_t md_acme_req_init_fn(md_acme_req_t *req, struct md_json_t *jpayload)
typedef apr_status_t md_acme_req_json_cb(md_acme_t *acme, apr_pool_t *p, const apr_table_t *headers, struct md_json_t *jbody, void *baton)

Request callback on a successful response (HTTP response code 2xx) and content type matching application/.*json.

typedef apr_status_t md_acme_req_res_cb(md_acme_t *acme, const struct md_http_response_t *res, void *baton)

Request callback on a successful HTTP response (status 2xx).

typedef struct md_acme_req_t md_acme_req_t
typedef struct md_acme_t md_acme_t

Enumeration Type Documentation

Enumerator
MD_ACME_S_UNKNOWN 
MD_ACME_S_REGISTERED 
MD_ACME_S_TOS_ACCEPTED 
MD_ACME_S_CHALLENGED 
MD_ACME_S_VALIDATED 
MD_ACME_S_CERTIFIED 
MD_ACME_S_DENIED 

Function Documentation

apr_status_t md_acme_acct_deactivate ( md_acme_t acme,
apr_pool_t p 
)

Deactivate the current account at the ACME server..

const char * md_acme_acct_id_get ( md_acme_t acme)

Get the local name of the account currently used by the acme instance. Will be NULL if no account has been setup successfully.

const char* md_acme_acct_url_get ( md_acme_t acme)
apr_status_t md_acme_agree ( md_acme_t acme,
apr_pool_t p,
const char *  tos 
)

Agree to the given Terms-of-Service url for the current account.

apr_status_t md_acme_check_agreement ( md_acme_t acme,
apr_pool_t p,
const char *  agreement,
const char **  prequired 
)

Confirm with the server that the current account agrees to the Terms-of-Service given in the agreement url. If the known agreement is equal to this, nothing is done. If it differs, the account is re-validated in the hope that the server announces the Tos URL it wants. If this is equal to the agreement specified, the server is notified of this. If the server requires a ToS that the account thinks it has already given, it is resend.

If an agreement is required, different from the current one, APR_INCOMPLETE is returned and the agreement url is returned in the parameter.

void md_acme_clear_acct ( md_acme_t acme)

Clear any existing account data from acme instance.

apr_status_t md_acme_create ( md_acme_t **  pacme,
apr_pool_t p,
const char *  url,
const char *  proxy_url 
)

Create a new ACME server instance. If path is not NULL, will use that directory for persisting information. Will load any information persisted in earlier session. url needs only be specified for instances where this has never been persisted before.

Parameters
pacmewill hold the ACME server instance on success
ppool to used
urlurl of the server, optional if known at path
proxy_urloptional url of a HTTP(S) proxy to use
apr_status_t md_acme_GET ( md_acme_t acme,
const char *  url,
md_acme_req_init_cb on_init,
md_acme_req_json_cb on_json,
md_acme_req_res_cb on_res,
md_acme_req_err_cb on_err,
void baton 
)
apr_status_t md_acme_get_json ( struct md_json_t **  pjson,
md_acme_t acme,
const char *  url,
apr_pool_t p 
)

Retrieve a JSON resource from the ACME server

apr_status_t md_acme_init ( apr_pool_t pool,
const char *  base_version,
int  init_ssl 
)

Global init, call once at start up.

apr_status_t md_acme_POST ( md_acme_t acme,
const char *  url,
md_acme_req_init_cb on_init,
md_acme_req_json_cb on_json,
md_acme_req_res_cb on_res,
md_acme_req_err_cb on_err,
void baton 
)

Perform a POST against the ACME url. If a on_json callback is given and the HTTP response is JSON, only this callback is invoked. Otherwise, on HTTP status 2xx, the on_res callback is invoked. If no on_res is given, it is considered a response error, since only JSON was expected. At least one callback needs to be non-NULL.

Parameters
acmethe ACME server to talk to
urlthe url to send the request to
on_initcallback to initialize the request data
on_jsoncallback on successful JSON response
on_rescallback on successful HTTP response
batonuserdata for callbacks
apr_status_t md_acme_POST_new_account ( md_acme_t acme,
md_acme_req_init_cb on_init,
md_acme_req_json_cb on_json,
md_acme_req_res_cb on_res,
md_acme_req_err_cb on_err,
void baton 
)
apr_status_t md_acme_protos_add ( struct apr_hash_t protos,
apr_pool_t p 
)
void md_acme_report_result ( md_acme_t acme,
apr_status_t  rv,
struct md_result_t result 
)
apr_status_t md_acme_req_body_init ( md_acme_req_t req,
struct md_json_t payload 
)
apr_status_t md_acme_save_acct ( md_acme_t acme,
apr_pool_t p,
struct md_store_t store 
)
apr_status_t md_acme_setup ( md_acme_t acme,
struct md_result_t result 
)

Contact the ACME server and retrieve its directory information.

Parameters
acmethe ACME server to contact
apr_status_t md_acme_use_acct ( md_acme_t acme,
struct md_store_t store,
apr_pool_t p,
const char *  acct_id 
)

Specify the account to use by name in local store. On success, the account the "current" one used by the acme instance.