|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
Automatic certificates for one native BWS HTTPS port.
Start with the SharkTrustX C Client manual for certificate basics, a C integration example, build requirements, storage, and cleanup. The runnable example is in examples/SharkTrustX/readme.html.
Compile BWS.c with SHARKTRUSTX, BA_JSON=1, and SHARKSSL_ENABLE_CERTINFO_PARSE_API=1. BWS includes the client and its dependencies; do not compile SharkTrustX.c separately. Compile the portal's generated tokengen.c with TOKENGEN_C_API.
One client manages one HTTPS port, using IPv6 first and then IPv4 when USE_IPV6 is enabled. Hold the server dispatcher mutex when calling this API; never call from an interrupt. Keep configuration and borrowed objects alive and unchanged until successful cleanup completes. start() acceptance is separate from certificate readiness. clean() erases state and is not a normal shutdown operation. Saved keys are UNENCRYPTED: the supplied IoIntf must be private and must never be served over HTTP.
#include <HttpServer.h>#include <BaTimer.h>#include <IoIntf.h>#include <SharkSSL.h>#include <stddef.h>
Go to the source code of this file.
Classes | |
| struct | SharkTrustX_Config |
| Required integration objects and provisioning information. More... | |
| struct | SharkTrustX_Status |
| Snapshot of the certificate currently served by the managed listeners. More... | |
Typedefs | |
| typedef enum SharkTrustX_Code | SharkTrustX_Code |
| Numeric lifecycle notifications and errors. More... | |
| typedef int(* | SharkTrustX_Proof) (const unsigned char *message, size_t messageLen, unsigned char proof[32]) |
| Compute the portal proof using generated tokengen code. More... | |
| typedef void(* | SharkTrustX_Event) (void *context, int code) |
| Receive one numeric event. More... | |
| typedef void(* | SharkTrustX_Name) (void *context, const char *name, size_t length) |
| Receive the portal-confirmed DNS name, independently of HTTPS readiness. More... | |
| typedef struct SharkTrustX_Config | SharkTrustX_Config |
| Required integration objects and provisioning information. More... | |
| typedef struct SharkTrustX_Status | SharkTrustX_Status |
| Snapshot of the certificate currently served by the managed listeners. More... | |
Enumerations | |
| enum | SharkTrustX_Code { SharkTrustX_Ready = 1 , SharkTrustX_Retry = 2 , SharkTrustX_Busy = -1 , SharkTrustX_Identity = -2 , SharkTrustX_Storage = -3 , SharkTrustX_Portal = -4 , SharkTrustX_Acme = -5 , SharkTrustX_Trust = -6 , SharkTrustX_Crypto = -7 , SharkTrustX_Terms = -9 } |
| Numeric lifecycle notifications and errors. More... | |
Functions | |
| BA_API int | SharkTrustX_start (const SharkTrustX_Config *config) |
| Start registration, certificate installation, and automatic renewal. More... | |
| BA_API BaBool | SharkTrustX_getStatus (SharkTrustX_Status *status) |
| Copy current certificate status without network or storage operations. More... | |
| BA_API int | SharkTrustX_setIpAddress (const char *address) |
| Ask the active client to publish a changed local IPv4 address. More... | |
| BA_API int | SharkTrustX_clean (IoIntf *io, BaBool all, SharkTrustX_Event onClean, void *context) |
| Stop work, close the managed listener, and erase owned certificate state. More... | |
| typedef enum SharkTrustX_Code SharkTrustX_Code |
Numeric lifecycle notifications and errors.
Zero is an accepted start/cleanup/address request, or successful cleanup completion. getStatus() instead returns a BaBool indicating active management.
| typedef struct SharkTrustX_Config SharkTrustX_Config |
Required integration objects and provisioning information.
Initialize to zero, then set required members. All pointers and strings are borrowed until successful cleanup completes, including the config itself. Do not modify them while management or cleanup is active. See
.
| typedef void(* SharkTrustX_Event) (void *context, int code) |
Receive one numeric event.
| context | Application pointer from configuration or clean(). |
| code | A SharkTrustX_Code; a cleanup callback receives 0 or a negative error. No keys or credentials are passed to callbacks. onEvent runs on the timer worker with the dispatcher mutex held. onClean uses that worker for active cleanup, or runs inline for an inactive store. Keep callbacks short and nonblocking. See
|
| typedef void(* SharkTrustX_Name) (void *context, const char *name, size_t length) |
Receive the portal-confirmed DNS name, independently of HTTPS readiness.
| context | Application pointer from configuration. |
| name | Borrowed, NUL-terminated full DNS name, valid during this call; NULL for an IP-only SharkCA enrollment. Copy it if needed after returning. |
| length | DNS name length in bytes, or zero for IP-only enrollment. Called once after confirmation on each start, then only when the name changes. A SharkCA host must arrange its own .local mDNS advertisement. |
| typedef int(* SharkTrustX_Proof) (const unsigned char *message, size_t messageLen, unsigned char proof[32]) |
Compute the portal proof using generated tokengen code.
| message | Borrowed binary input, possibly containing zero bytes. |
| messageLen | Number of input bytes, not strlen(message). |
| proof | Required output buffer for exactly 32 bytes. |
| typedef struct SharkTrustX_Status SharkTrustX_Status |
Snapshot of the certificate currently served by the managed listeners.
This value contains no pointers or private key material.
| enum SharkTrustX_Code |
Numeric lifecycle notifications and errors.
Zero is an accepted start/cleanup/address request, or successful cleanup completion. getStatus() instead returns a BaBool indicating active management.
| BA_API int SharkTrustX_clean | ( | IoIntf * | io, |
| BaBool | all, | ||
| SharkTrustX_Event | onClean, | ||
| void * | context | ||
| ) |
Stop work, close the managed listener, and erase owned certificate state.
| io | Required store used by the active client, or an inactive store. |
| all | TRUE also removes portal enrollment; FALSE retains completed or pending enrollment. SharkCA also retains its bound account key/directory; public builds remove account/provider state, permitting a provider change. |
| onClean | Optional completion callback; may run before return if idle. |
| context | Optional borrowed pointer for onClean. |
| BA_API BaBool SharkTrustX_getStatus | ( | SharkTrustX_Status * | status | ) |
Copy current certificate status without network or storage operations.
| status | Required caller-owned output; all fields are overwritten. |
| BA_API int SharkTrustX_setIpAddress | ( | const char * | address | ) |
Ask the active client to publish a changed local IPv4 address.
| address | Dotted IPv4 string, copied before returning; NULL discovers the address of the next trusted portal connection. No periodic address discovery is performed. The host calls this after a network change. |
| BA_API int SharkTrustX_start | ( | const SharkTrustX_Config * | config | ) |
Start registration, certificate installation, and automatic renewal.
| config | Required configuration retained until cleanup completes. |