NetBurner 3.1
ssl.h File Reference

NetBurner SSL API. More...

#include <nettypes.h>
#include <predef.h>
#include <crypto/SharkSsl.h>
#include <random.h>

Go to the source code of this file.

Macros

#define SSL_ERROR_FAILED_NEGOTIATION   (-256)
 The SSL system failed to successfully negotiate a connection.
 
#define SSL_ERROR_HASH_FAILED   (-257)
 The connection failed the startup hash test.
 
#define SSL_ERROR_CERTIFICATE_UNKNOWN   (-258)
 The received certificate could not be decoded.
 
#define SSL_ERROR_WRITE_FAIL   (-259)
 The connection failed to write out a full record.
 
#define SSL_ERROR_CERTIFICATE_NAME_FAILED   (-260)
 The connected name did not match common_name.
 
#define SSL_ERROR_CERTIFICATE_VERIFY_FAILED   (-261)
 The server returned a certificate that we did not trust.
 
#define SSL_ERROR_NO_BUFFER   (-262)
 Unable to get a buffer from the pool.
 
#define SSL_ERROR_CLIENT_NOT_EN   (-263)
 Unable to get a buffer from the pool.
 
#define SSL_ERROR_SERVER_NOT_EN   (-264)
 Unable to get a buffer from the pool.
 
#define SSL_ERROR_HANDSHAKE_INCOMPLETE   (-265)
 The SSL handshake is not complete yet.
 

Functions

int SSL_accept (int fdListen, IPADDR *address, uint16_t *port, uint16_t accept_timeout, uint16_t negotiation_timeout=0)
 This call is a mirror of the TCP::accept() call. More...
 
BOOL IsSSLfd (int fd)
 Returns whether or not a file descriptor is an SSL file descriptor. More...
 
IPADDR SSL_GetSocketRemoteAddr (int fd)
 Returns the remote address of this connected socket. More...
 
int SSL_GetSocketInterface (int fd)
 Return the network interface associated with a TCP socket. More...
 
uint16_t SSL_GetSocketRemotePort (int fd)
 Returns the remote port of this connected socket. More...
 
IPADDR SSL_GetSocketLocalAddr (int fd)
 Returns the local address of this connected socket. More...
 
uint16_t SSL_GetSocketLocalPort (int fd)
 Returns the local port of this connected socket. More...
 
uint32_t SSL_TcpGetLastRxTime (int fd)
 SSL mirror of TcpGetLastRxTime(). More...
 
void SSL_TcpSendKeepAlive (int fd)
 SSL mirror of TcpSendKeepAlive(). More...
 
int SSL_setsockoption (int fd, int option)
 Set SSL TCP socket options. More...
 
int SSL_clrsockoption (int fd, int option)
 Clear SSL TCP socket options. More...
 
int SSL_getsockoption (int fd)
 Returns the options for the specified SSL TCP socket. More...
 
int SSL_getsocketerror (int fd)
 Returns the socket error state for the specified SSL socket. More...
 
int SSL_connect (IPADDR ip, uint16_t local_port, uint16_t remote_port, uint32_t timeout, const char *common_name, bool verifyPeer=false, bool waitForNegotiation=true, SharkSslCAList caList=nullptr)
 SSL mirror of the TCP::connect() call. More...
 
int SSL_makeSecure (int fds, uint32_t timeout, const char *common_name, bool verifyPeer=false, bool waitForNegotiation=true, SharkSslCAList caList=nullptr, bool bIsClient=true)
 Executes the TLS negotiation over a given socket, to establish a secure communication channel through that socket. More...
 
int SSL_negotiate (int fds, uint32_t timeout, const char *common_name, bool reuseSessionPort=true, bool verifyPeer=false, SharkSslCAList caList=nullptr, bool bIsClient=true)
 SSL mirror of the TCP::connect() call, but uses an existing TCP file descriptor. More...
 
int SSLReadWithTimeout (int fd, char *cp, int size, uint32_t timeout)
 SSL mirror of the ReadWithTiemout() function. More...
 
uint32_t SetMaxSessionReuseTime (uint32_t newLifetimeTicks)
 Allows one to specify at runtime what the longest duration that an established session can be used for before new connections must be fully renegotiated. More...
 
const char * GetCertificatePEM ()
 Function that returns a pointer to the compiled in server certificate. More...
 
const char * GetPrivateKeyPEM ()
 Function that returns a pointer to the compiled in server key. More...
 
bool IsSSL_CertNKeyValid (const char *keyPEM, ssize_t keylen, const char *certPEM, ssize_t certlen)
 Validate candidate certificate and private key.
 
bool SSL_SetClientCAList (SharkSslCAList *CAList)
 Attempts to set the Certificate Authority List for the SharkSsl clientCtx More...
 
bool SSL_SetServerCAList (SharkSslCAList *CAList)
 Attempts to set the Certificate Authority List for the SharkSsl serverCtx More...
 
uint16_t SSLGetRxBufferSpaceUsed (int fd)
 Returns the amount of data buffered to be read from the socket. More...
 
uint16_t SSLGetTxBufferAvailSpace (int fd)
 Returns the amount of data buffered to be read from the socket. More...
 

Detailed Description

NetBurner SSL API.