CCF
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ccf::ACMEClient Class Reference

#include <ccf_acme_client.h>

Inherits ACME::Client.

Classes

struct  ACMEClientMsg
 
class  DefaultChallengeHandler
 

Public Member Functions

 ACMEClient (const std::string &config_name, const ACMEClientConfig &config, std::shared_ptr< RPCMap > rpc_map, std::shared_ptr< RPCSessions > rpc_sessions, std::shared_ptr< ACMERpcFrontend > challenge_frontend, std::shared_ptr< ccf::kv::Store > store, std::shared_ptr< ccf::crypto::KeyPair > account_key_pair=nullptr, std::shared_ptr< ACMEChallengeHandler > challenge_handler_=nullptr)
 
virtual ~ACMEClient ()
 
virtual void set_account_key (std::shared_ptr< ccf::crypto::KeyPair > new_account_key_pair) override
 
virtual void check_expiry (std::shared_ptr< ccf::kv::Store > tables, std::unique_ptr< NetworkIdentity > &identity)
 
virtual void install_custom_challenge_handler (std::shared_ptr< ACMEChallengeHandler > h)
 
- Public Member Functions inherited from ACME::Client
 Client (const ClientConfig &config, std::shared_ptr< ccf::crypto::KeyPair > account_key_pair=nullptr)
 
virtual ~Client ()
 
void get_certificate (std::shared_ptr< ccf::crypto::KeyPair > service_key_, bool override_time=false)
 
void start_challenge (const std::string &token)
 
bool has_active_orders () const
 

Protected Member Functions

void install_wildcard_response ()
 
virtual void on_http_request (const ::http::URL &url, ::http::Request &&req, std::function< bool(ccf::http_status status, http::HeaderMap &&, std::vector< uint8_t > &&)> callback) override
 
virtual void on_challenge (const std::string &token, const std::string &response) override
 
virtual void on_challenge_finished (const std::string &token) override
 
virtual void on_certificate (const std::string &certificate) override
 
- Protected Member Functions inherited from ACME::Client
virtual void on_http_request (const http::URL &url, http::Request &&req, std::function< bool(ccf::http_status status, ccf::http::HeaderMap &&, std::vector< uint8_t > &&)> callback)=0
 
void make_request (llhttp_method method, const http::URL &url, const std::vector< uint8_t > &body, ccf::http_status expected_status, std::function< bool(const ccf::http::HeaderMap &, const std::vector< uint8_t > &)> ok_callback)
 
void make_json_request (llhttp_method method, const http::URL &url, const std::vector< uint8_t > &body, ccf::http_status expected_status, std::function< void(const ccf::http::HeaderMap &headers, const nlohmann::json &)> ok_callback)
 
void post_as_get (const std::string &account_url, const std::string &resource_url, std::function< bool(const ccf::http::HeaderMap &, const std::vector< uint8_t > &)> ok_callback)
 
void post_as_get_json (const std::string &account_url, const std::string &resource_url, std::function< bool(const ccf::http::HeaderMap &, const nlohmann::json &)> ok_callback, bool empty_payload=false)
 
Orderget_order (const std::string &order_url)
 
void remove_order (const std::string &order_url)
 
nlohmann::json mk_kid_header (const std::string &account_url, const std::string &nonce, const std::string &resource_url)
 
void request_directory ()
 
void request_new_nonce (std::function< void()> ok_callback)
 
void request_new_account ()
 
void authorize_next_challenge (const std::string &order_url)
 
void request_new_order (const std::string &account_url)
 
void request_authorization (Order &order, const std::string &authz_url)
 
std::string make_challenge_response () const
 
void add_challenge (Order &order, const std::string &token, const std::string &authorization_url, const std::string &challenge_url)
 
std::unique_ptr< threading::Tmsg< ChallengeWaitMsg > > schedule_check_challenge (const std::string &order_url, Challenge &challenge)
 
bool check_challenge (const std::string &order_url, const Challenge &challenge)
 
void finish_challenge (const std::string &order_url, const std::string &challenge_token)
 
bool check_finalization (const std::string &order_url)
 
std::unique_ptr< threading::Tmsg< FinalizationWaitMsg > > schedule_check_finalization (const std::string &order_url)
 
virtual std::vector< uint8_t > get_service_csr ()
 
void request_finalization (const std::string &order_url)
 
void request_certificate (const std::string &order_url)
 

Protected Attributes

std::string config_name
 
std::shared_ptr< RPCMaprpc_map
 
std::shared_ptr< RPCSessionsrpc_sessions
 
std::shared_ptr< ACMERpcFrontendchallenge_frontend
 
std::shared_ptr< ccf::kv::Storestore
 
std::shared_ptr< ACMEChallengeHandlerchallenge_handler
 
- Protected Attributes inherited from ACME::Client
ClientConfig config
 
std::shared_ptr< ccf::crypto::KeyPairservice_key
 
std::shared_ptr< ccf::crypto::KeyPairaccount_key_pair
 
nlohmann::json directory
 
nlohmann::json account
 
std::list< std::string > nonces
 
ccf::pal::Mutex req_lock
 
ccf::pal::Mutex orders_lock
 
std::optional< std::chrono::system_clock::time_point > last_request
 
size_t num_failed_attempts = 0
 
std::list< Orderactive_orders
 

Additional Inherited Members

- Protected Types inherited from ACME::Client
enum  OrderStatus { ACTIVE , FINISHED , FAILED }
 
- Static Protected Member Functions inherited from ACME::Client
static http::URL with_default_port (const std::string &url, const std::string &default_port="443")
 
static std::vector< uint8_t > s2v (const std::string &s)
 
static std::vector< uint8_t > json_to_bytes (const nlohmann::json &j)
 
static std::string json_to_b64url (const nlohmann::json &j, bool with_padding=true)
 
static void convert_signature_to_ieee_p1363 (std::vector< uint8_t > &sig, const ccf::crypto::KeyPair &signer)
 
static std::optional< std::string > get_header_value (const ccf::http::HeaderMap &headers, const std::string &name)
 
static void expect (const nlohmann::json &j, const std::string &key)
 
static void expect_string (const nlohmann::json &j, const std::string &key, const std::string &value)
 
static std::pair< std::string, std::string > get_crv_alg (const std::shared_ptr< ccf::crypto::KeyPair > &key_pair)
 

Constructor & Destructor Documentation

◆ ACMEClient()

ccf::ACMEClient::ACMEClient ( const std::string &  config_name,
const ACMEClientConfig config,
std::shared_ptr< RPCMap rpc_map,
std::shared_ptr< RPCSessions rpc_sessions,
std::shared_ptr< ACMERpcFrontend challenge_frontend,
std::shared_ptr< ccf::kv::Store store,
std::shared_ptr< ccf::crypto::KeyPair account_key_pair = nullptr,
std::shared_ptr< ACMEChallengeHandler challenge_handler_ = nullptr 
)
inline

◆ ~ACMEClient()

virtual ccf::ACMEClient::~ACMEClient ( )
inlinevirtual

Member Function Documentation

◆ check_expiry()

virtual void ccf::ACMEClient::check_expiry ( std::shared_ptr< ccf::kv::Store tables,
std::unique_ptr< NetworkIdentity > &  identity 
)
inlinevirtual

◆ install_custom_challenge_handler()

virtual void ccf::ACMEClient::install_custom_challenge_handler ( std::shared_ptr< ACMEChallengeHandler h)
inlinevirtual

◆ install_wildcard_response()

void ccf::ACMEClient::install_wildcard_response ( )
inlineprotected

◆ on_certificate()

virtual void ccf::ACMEClient::on_certificate ( const std::string &  certificate)
inlineoverrideprotectedvirtual

Implements ACME::Client.

◆ on_challenge()

virtual void ccf::ACMEClient::on_challenge ( const std::string &  token,
const std::string &  response 
)
inlineoverrideprotectedvirtual

Implements ACME::Client.

◆ on_challenge_finished()

virtual void ccf::ACMEClient::on_challenge_finished ( const std::string &  token)
inlineoverrideprotectedvirtual

Implements ACME::Client.

◆ on_http_request()

virtual void ccf::ACMEClient::on_http_request ( const ::http::URL url,
::http::Request &&  req,
std::function< bool(ccf::http_status status, http::HeaderMap &&, std::vector< uint8_t > &&)>  callback 
)
inlineoverrideprotectedvirtual

◆ set_account_key()

virtual void ccf::ACMEClient::set_account_key ( std::shared_ptr< ccf::crypto::KeyPair new_account_key_pair)
inlineoverridevirtual

Reimplemented from ACME::Client.

Member Data Documentation

◆ challenge_frontend

std::shared_ptr<ACMERpcFrontend> ccf::ACMEClient::challenge_frontend
protected

◆ challenge_handler

std::shared_ptr<ACMEChallengeHandler> ccf::ACMEClient::challenge_handler
protected

◆ config_name

std::string ccf::ACMEClient::config_name
protected

◆ rpc_map

std::shared_ptr<RPCMap> ccf::ACMEClient::rpc_map
protected

◆ rpc_sessions

std::shared_ptr<RPCSessions> ccf::ACMEClient::rpc_sessions
protected

◆ store

std::shared_ptr<ccf::kv::Store> ccf::ACMEClient::store
protected

The documentation for this class was generated from the following file: