|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
The adapter provides source compatibility for applications that use the TLS and cryptography calls listed below. Compile those applications against the adapter headers and select the components they use. Start with the memory BIO example when learning the adapter; it requires neither a socket nor a native TLS build.
| Area | Supported behavior |
|---|---|
| BIO | Memory and application-defined BIOs, reference ownership, retries and optional dispatcher attachment. BIO contract |
| Parameters | Typed OSSL_PARAM values used by the supported EVP functions. |
| AES-GCM | Incremental AES-128/256-GCM with 12-byte nonces and 16-byte tags. GCM contract |
| Hash, MAC, KDF and RNG | Configured SHA-2 digests, HMAC, HKDF, optional PBKDF2 and RAND_bytes / RAND_bytes_ex. Crypto contract |
| Public keys and signatures | Import unencrypted PKCS#8 or traditional RSA/EC private keys and SubjectPublicKeyInfo public keys from PEM memory BIOs. Sign and verify messages or precomputed digests using RSA PKCS#1 v1.5, RSA-PSS or DER-encoded ECDSA. PEM and signature APIs · PSS padding, salt length and MGF1 |
| TLS | TLS 1.2/1.3 client and server handshakes, record I/O, shutdown and peer verification. Hosted applications can attach a caller-owned socket using SSL_set_fd. TLS contract |
| TLS configuration and information | Explicit cipher names, version bounds, negotiated information and ALPN. Controls · Connection information · ALPN |
| Credentials and trust | Unencrypted PEM certificate, key and CA file loading, SharkSSL buffer loaders and one client identity per context. Embedded clients can use the shipped SharkSSL CA list as default trust and supply a private CA explicitly. Buffer loading · Mutual TLS · Embedded default trust |
| X509 | Inspect retained certificate metadata. Leaf public-key pinning requires opt-in retention of the encoded SubjectPublicKeyInfo. X509 contract |
| ERR | Fixed-size per-thread diagnostics. Error queue contract |
Select pkey for PEM keys and signatures. It includes bio and evp_hash and compiles src/SharkSslOsslPkey.c. The matching native library must enable the PEM API and the chosen RSA or ECDSA algorithm. RSA-PSS also requires SHARKSSL_ENABLE_RSASSA_PSS. The application seeds the RNG before signing.
The TLS component includes the optional Eclipse Paho MQTT C and libevent integration headers. Include the relevant header only when building that consumer. The Paho profile requires hosted sockets, PEM file loading, default trust, RAND and the trace stubs. Its diagnostic callbacks emit no events and reconnection uses a fresh TLS handshake. Paho profile
Encrypted private keys, password-based key loading, hardware key handles, full certificate DER retention, OCSP and dynamic client-identity selection are outside the supported subset. Certificate validation follows SharkSSL's date policy, including its 24-hour start-date allowance. The application supplies RNG initialization, time and the selected platform hooks.
Apply the same component mask to the adapter and its callers. Link one matching native SharkSSL implementation when using crypto or TLS. The example Makefile and Windows projects list each program's sources and compiler settings. See the examples for build instructions.
The dispatcher supports Windows, Linux/POSIX and ThreadX/NetX Duo. An SDK application reuses its dispatcher objects. A standalone package supplies the selected networking sources and port settings. A hosted caller using SSL_set_fd can use its own event loop. Socket ownership and setup