![]() |
NetBurner 3.4.0
PDF Version |
Modules | |
Onboard Certificate Generation | |
SSL Error Codes | |
Enumerations | |
enum class | ExpireRetCodes : unsigned char { ExpireRetCodes::E_CERT_VALID = 0 , ExpireRetCodes::E_CERT_EXPIRED = 1 , ExpireRetCodes::E_BAD_EXPIRATION_VALUE = 2 , ExpireRetCodes::E_NO_SYSTEM_TIME = 3 } |
Return values for SSL_IsCertExpired(). More... | |
Functions | |
int | SSL_accept (int fdListen, IPADDR *address, uint16_t *port, uint16_t timeout, bool waitForNegotiation=true, bool verifyPeer=false, const unsigned char *certBuff=nullptr, uint32_t certBuffSize=0, uint16_t certBuffFormat=SSL_FILETYPE_PEM, const char *commonName=nullptr) |
This call is a mirror of the TCP::accept() call. More... | |
bool | SSLSocketsAvail () |
Returns whether or not there are any sockets available. More... | |
int | FreeSSLSockets () |
Returns the number of currently free SSL sockets. 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 localPort, uint16_t remotePort, uint32_t timeout, const char *commonName, bool verifyPeer=false, bool waitForNegotiation=true, const unsigned char *certBuff=nullptr, uint32_t certBuffSize=0, uint16_t certBuffFormat=SSL_FILETYPE_PEM, int intf=-1) |
SSL mirror of the TCP::connect() call. More... | |
int | SSL_makeSecure (int tcpFd, const char *commonName, bool verifyPeer=false, bool waitForNegotiation=true, const unsigned char *certBuff=nullptr, uint32_t certBuffSize=0, uint16_t certBuffFormat=SSL_FILETYPE_PEM, bool bIsClient=true, uint32_t timeout=WAIT_FOREVER) |
SSL mirror of the TCP::connect() call, but uses an existing TCP file descriptor. More... | |
int | SSL_negotiate (int tcpFd, const char *common_name, bool reuseSessionPort=true, bool verifyPeer=false, const unsigned char *certBuff=nullptr, uint32_t certBuffSize=0, uint16_t certBuffFormat=SSL_FILETYPE_PEM, bool bIsClient=true) |
Executes the TLS negotiation over a given socket, to establish a secure communication channel through that socket. 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... | |
bool | IsSSL_CertNKeyValid (const char *keyPEM, ssize_t keylen, const char *certPEM, ssize_t certlen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Validate candidate certificate and private key. More... | |
bool | SSL_AddCertToClientCaList (const unsigned char *certBuff=nullptr, uint32_t certBuffSize=0, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Attempts to add a cert to the Certificate Authority List to the client SSL context. More... | |
bool | SSL_AddCertToServerCaList (const unsigned char *certBuff=nullptr, uint32_t certBuffSize=0, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Attempts to add a cert to the Certificate Authority List to the client SSL context. More... | |
bool | SSL_ClearClientCaList () |
Clears certs that have been added to the client's Certificate Authority list. More... | |
bool | SSL_ClearServerCaList () |
Clears certs that have been added to the server's Certificate Authority list. 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... | |
void | SslInit () |
This function initializes the SSL library. More... | |
void | SSL_DumpSSLSockets () |
Prints the current state of all used sockets to stdio. | |
void | SSL_ClientReadyCert (const unsigned char *cert, const unsigned char *key, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Add a key and certificate to the client. More... | |
void | SSL_ServerReadyCert (const unsigned char *cert, const unsigned char *key, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Add a key and certificate to the server. More... | |
ExpireRetCodes | SSL_IsCertExpired (unsigned char *certBuff, int certLen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Returns whether the given certificate has expired or not. More... | |
bool | SSL_GetIssuerFromCert (unsigned char *certBuff, int certLen, unsigned char *issBuf, int issBufLen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Returns the issuer from a certificate blob in the PEM format. More... | |
bool | SSL_GetSubjectNameFromCert (unsigned char *certBuff, int certLen, unsigned char *subNamBuf, int subNamBufLen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Returns the subject name from a certificate blob in the PEM format. More... | |
bool | SSL_GetAltNameFromCert (unsigned char *certBuff, int certLen, unsigned char *altNamBuf, int altNamBufLen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Returns an alternate name from a certificate blob in the PEM format. More... | |
bool | SSL_GetExpirationDate (unsigned char *certBuff, int certLen, unsigned char *expBuf, int expBufLen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Returns the expiration data of the certificate in question. More... | |
bool | SSL_GetTimeToExpire (unsigned char *certBuff, int certLen, uint16_t certBuffFormat, time_t &timeToExp) |
Returns whether the given certificate has expired or not. More... | |
bool | SSL_GetCnFromCert (unsigned char *certBuff, int certLen, unsigned char *comNamBuf, int comNamBufLen, uint16_t certBuffFormat=SSL_FILETYPE_PEM) |
Returns the common name from a certificate blob in the PEM format. More... | |
const char * | GetCertificatePEM () |
Function that returns a pointer to the compiled in server certificate. More... | |
int | GetCertificateLen () |
Function that the length of the compiled in server certificate. More... | |
const char * | GetPrivateKeyPEM () |
Function that returns a pointer to the compiled in server key. More... | |
int | GetPrivateKeyLen () |
Function that the length of the compiled in server key. More... | |
void | SslSetVerifyPeerClient (bool verifyPeer) |
Sets whether or not verify peer should be enabled on the global SSL client context. More... | |
void | SslSetVerifyPeerServer (bool verifyPeer) |
Sets whether or not verify peer should be enabled on the global SSL server context. More... | |
bool | SSL_IsCertAddedToClientCaList () |
Checks to see if any certificates have been added to the global SSL client context. More... | |
bool | SSL_IsCertAddedToServerCaList () |
Checks to see if any certificates have been added to the global SSL server context. More... | |
Variables | |
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... | |
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... | |
int(* | SSL_GetSocketInterface )(int fd) |
Return the network interface associated with an SSL TCP socket. More... | |
int(* | SSL_GetRawSocket )(int sslSocketFd) |
Returns the TCP file descriptor associated with an SSL socket file descriptor. More... | |
uint16_t(* | SSL_GetTcpRtxCount )(int i) |
Returns the number of re-transmits that have occurred on the specified SSL connection. More... | |
uint32_t(* | SSL_TcpGetLastRxTime )(int fd) |
SSL mirror of TcpGetLastRxTime(). More... | |
void(* | SSL_TcpSendKeepAlive )(int fd) |
SSL mirror of TcpSendKeepAlive(). More... | |
short(* | SSL_TcpGetSocketState )(int fd) |
Return the current state of a SSL TCP socket. More... | |
The NetBurner SSL/TLS Library
|
strong |
Return values for SSL_IsCertExpired().
int FreeSSLSockets | ( | ) |
Returns the number of currently free SSL sockets.
int GetCertificateLen | ( | ) |
Function that the length of the compiled in server certificate.
See the SSL documentation and examples for information on generating a self signed certificate and key. This function can be overridden to provide the ability to install uploaded certificates.
Function that the length of the compiled in server certificate.
Pointer | to the found cert |
Function that the length of the compiled in server certificate.
const char * GetCertificatePEM | ( | ) |
Function that returns a pointer to the compiled in server certificate.
See the SSL documentation and examples for information on generating a self signed certificate and key.
Function that returns a pointer to the compiled in server certificate.
Pointer | to the found cert |
Function that returns a pointer to the compiled in server certificate.
int GetPrivateKeyLen | ( | ) |
Function that the length of the compiled in server key.
See the SSL documentation and examples for information on generating a self signed certificate and key. This function can be overridden to provide the ability to install uploaded keys.
Function that the length of the compiled in server key.
Pointer | to the found key |
Function that the length of the compiled in server key.
const char * GetPrivateKeyPEM | ( | ) |
Function that returns a pointer to the compiled in server key.
See the SSL documentation and examples for information on generating a self signed certificate and key.
Function that returns a pointer to the compiled in server key.
Pointer | to the found key |
Function that returns a pointer to the compiled in server key.
bool IsSSL_CertNKeyValid | ( | const char * | keyPEM, |
ssize_t | keylen, | ||
const char * | certPEM, | ||
ssize_t | certlen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Validate candidate certificate and private key.
Determines if the passed in certificate and private key are valid or note.
keyPEM | A buffer containing the private key |
keylen | The length of the buffer containing the private key |
certPEM | A buffer containing the certificate |
certlen | The length of the buffer containing the certificate |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | Certificate and key passed in are valid |
<code>false</code> | Certificate and/or key passed in are not valid |
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.
This is a security trade-off feature. It will negatively impact performance to decrease this value. To disable maximum reuse lifetime, pass the argument as 0. This will force a new negotiation on every connection. Calling this functhyion will not affect sessions that are currently stored until they have been used to establish a new connection.
The default value used for this purpose on startup is defined in predef.h as the macro SSL_DEFAULT_MAX_SESSION_AGE_TICKS and is set to one hour.
newLifetimeTicks | How long (in ticks) to allow an established session to be used. |
int SSL_accept | ( | int | fdListen, |
IPADDR * | address, | ||
uint16_t * | port, | ||
uint16_t | timeout, | ||
bool | waitForNegotiation = true , |
||
bool | verifyPeer = false , |
||
const unsigned char * | certBuff = nullptr , |
||
uint32_t | certBuffSize = 0 , |
||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM , |
||
const char * | commonName = nullptr |
||
) |
This call is a mirror of the TCP::accept() call.
fdListen | File descriptor of the TCP listening socket. |
*address | IPADDR variable to hold the address of the connecting computer. |
*port | Variable to receive the remote port of this connection. |
timeout | Number of system time ticks to wait for a connection (regular TCP::accept()). |
waitForNegotiation | Wait for negotiation to complete. Default is true. |
verifyPeer | Default is false. Set to true to verify the client certificate on connect. |
certBuff | Buffer containing the certificate data. Default is null. |
certBuffSize | Size of the buffer containing the certificate data. Default is 0. |
certBuffFormat | Format of the certificate buffer. Default is SSL_FILETYPE_PEM. |
commonName | Common name to use for checking certificate validity. Default is null, which will accept any connection. |
>0 | The file descriptor of the connected SSL socket |
<0 | The error code for the failure from SSL Error Codes or TCP Socket Status |
bool SSL_AddCertToClientCaList | ( | const unsigned char * | certBuff = nullptr , |
uint32_t | certBuffSize = 0 , |
||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Attempts to add a cert to the Certificate Authority List to the client SSL context.
certBuff | A buffer containing the certificate to add. |
certBuffSize | The size of the cert being passed in. |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | Successfully add the certificate to the CA List |
<code>false</code> | Was not able to add the certificate to the CA List |
bool SSL_AddCertToServerCaList | ( | const unsigned char * | certBuff = nullptr , |
uint32_t | certBuffSize = 0 , |
||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Attempts to add a cert to the Certificate Authority List to the client SSL context.
certBuff | A buffer containing the certificate to add. |
certBuffSize | The size of the cert being passed in. |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | Successfully add the certificate to the CA List |
<code>false</code> | Was not able to add the certificate to the CA List |
bool SSL_ClearClientCaList | ( | ) |
Clears certs that have been added to the client's Certificate Authority list.
<code>true</code> | Successfully cleared the Certificate Authority list |
<code>false</code> | Failed to clear the Certificate Authority list |
bool SSL_ClearServerCaList | ( | ) |
Clears certs that have been added to the server's Certificate Authority list.
<code>true</code> | Successfully cleared the Certificate Authority list |
<code>false</code> | Failed to clear the Certificate Authority list |
void SSL_ClientReadyCert | ( | const unsigned char * | cert, |
const unsigned char * | key, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Add a key and certificate to the client.
cert | Pointer to the buffer holding the PEM certificate data |
key | Pointer to the buffer holding the PEM key data |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
int SSL_clrsockoption | ( | int | fd, |
int | option | ||
) |
Clear SSL TCP socket options.
fd | Socket file descriptor. |
option | Socket option to clear: TCP Socket Options. |
int SSL_connect | ( | IPADDR | ip, |
uint16_t | localPort, | ||
uint16_t | remotePort, | ||
uint32_t | timeout, | ||
const char * | commonName, | ||
bool | verifyPeer = false , |
||
bool | waitForNegotiation = true , |
||
const unsigned char * | certBuff = nullptr , |
||
uint32_t | certBuffSize = 0 , |
||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM , |
||
int | intf = -1 |
||
) |
SSL mirror of the TCP::connect() call.
ip | The address to connect to. |
localPort | The local port to use. 0 will pick one |
remotePort | The remote port to connect to. |
timeout | The number of ticks to wait for a connection. |
*commonName | The common name to use for checking certificate validity passing in NULL will accept any connection. |
verifyPeer | Should the client verify the server's certificate against a Certificate Authority list? |
waitForNegotiation | Should the function wait until the negotiation is complete before returning? |
certBuff | Buffer containing the certificate data |
certBuffSize | Size of the buffer containing the certificate data |
certBuffFormat | The format of the certificate buffer |
intf | Optional local interface number to use for connection |
>0 | The file descriptor of the connected SSL socket |
<0 | The error code for the failure from SSL Error Codes or TCP Socket Status |
bool SSL_GetAltNameFromCert | ( | unsigned char * | certBuff, |
int | certLen, | ||
unsigned char * | altNamBuf, | ||
int | altNamBufLen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Returns an alternate name from a certificate blob in the PEM format.
certBuff | The buffer containing the certificate data |
certLen | The length of the certificate |
altNamBuf | The buffer to store the alternate name in |
altNamBufLen | The length of the buffer where the alternate name will be placed |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | If successfully retrieved the alternate name from the cert |
<code>false</code> | If unable to retrieved the alternate name from the cert |
bool SSL_GetCnFromCert | ( | unsigned char * | certBuff, |
int | certLen, | ||
unsigned char * | comNamBuf, | ||
int | comNamBufLen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Returns the common name from a certificate blob in the PEM format.
certBuff | The buffer containing the certificate data |
certLen | The length of the certificate |
comNamBuf | The buffer to store the common name in |
comNamBufLen | The length of the buffer where the common name will be placed |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | If successfully retrieved the common name from the cert |
<code>false</code> | If unable to retrieved the common name from the cert |
bool SSL_GetExpirationDate | ( | unsigned char * | certBuff, |
int | certLen, | ||
unsigned char * | expBuf, | ||
int | expBufLen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Returns the expiration data of the certificate in question.
certBuff | The buffer containing the certificate data |
certLen | The length of the certificate |
expBuf | The buffer to store the expiration date in |
expBufLen | The length of the buffer where the expiration date will be placed |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | If successfully retrieved the alternate name from the cert |
<code>false</code> | If unable to retrieved the alternate name from the cert |
bool SSL_GetIssuerFromCert | ( | unsigned char * | certBuff, |
int | certLen, | ||
unsigned char * | issBuf, | ||
int | issBufLen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Returns the issuer from a certificate blob in the PEM format.
certBuff | The buffer containing the certificate data |
certLen | The length of the certificate |
issBuf | The buffer to store the issuer in |
issBufLen | The length of the buffer where the issuer will be placed |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | If successfully retrieved the issuer from the cert |
<code>false</code> | If unable to retrieved the issuer from the cert |
int SSL_getsocketerror | ( | int | fd | ) |
Returns the socket error state for the specified SSL socket.
fd | Socket file descriptor. |
int SSL_getsockoption | ( | int | fd | ) |
Returns the options for the specified SSL TCP socket.
fd | Socket file descriptor. |
bool SSL_GetSubjectNameFromCert | ( | unsigned char * | certBuff, |
int | certLen, | ||
unsigned char * | subNamBuf, | ||
int | subNamBufLen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Returns the subject name from a certificate blob in the PEM format.
certBuff | The buffer containing the certificate data |
certLen | The length of the certificate |
subNamBuf | The buffer to store the subject name in |
subNamBufLen | The length of the buffer where the subject name will be placed |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>true</code> | If successfully retrieved the subject name from the cert |
<code>false</code> | If unable to retrieved the subject name from the cert |
bool SSL_GetTimeToExpire | ( | unsigned char * | certBuff, |
int | certLen, | ||
uint16_t | certBuffFormat, | ||
time_t & | timeToExp | ||
) |
Returns whether the given certificate has expired or not.
certBuff | The buffer containing the certificate data | |
certLen | The length of the certificate | |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. | |
[out] | timeToExp | The time the certificate is set to expire |
<code>true</code> | If the certificate expiration was found |
<code>false</code> | If the certificate expiration was not found |
bool SSL_IsCertAddedToClientCaList | ( | ) |
Checks to see if any certificates have been added to the global SSL client context.
Certificate Authority certificates can be added to the client context during calls to SSL_connect() or with calls to SSL_AddCertToClientCaList().
bool SSL_IsCertAddedToServerCaList | ( | ) |
Checks to see if any certificates have been added to the global SSL server context.
Certificate Authority certificates can be added to the server context during calls to SSL_connect() or with calls to SSL_AddCertToServerCaList().
ExpireRetCodes SSL_IsCertExpired | ( | unsigned char * | certBuff, |
int | certLen, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Returns whether the given certificate has expired or not.
certBuff | The buffer containing the certificate data |
certLen | The length of the certificate |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
<code>ExpireRetCodes::E_CERT_EXPIRED</code> | If the certificate has expired |
<code>ExpireRetCodes::E_CERT_VALID</code> | If the certificate has not expired |
<code>ExpireRetCodes::E_BAD_EXPIRATION_VALUE</code> | If unable to get the expiration data from the certificate |
<code>ExpireRetCodes::E_NO_SYSTEM_TIME</code> | If the system time has not been set |
int SSL_makeSecure | ( | int | tcpFd, |
const char * | commonName, | ||
bool | verifyPeer = false , |
||
bool | waitForNegotiation = true , |
||
const unsigned char * | certBuff = nullptr , |
||
uint32_t | certBuffSize = 0 , |
||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM , |
||
bool | bIsClient = true , |
||
uint32_t | timeout = WAIT_FOREVER |
||
) |
SSL mirror of the TCP::connect() call, but uses an existing TCP file descriptor.
tcpFd | The file descriptor for the socket to be secured. |
*commonName | The common name to use for checking certificate validity passing in NULL will accept any connection. |
verifyPeer | Should the client verify the server's certificate against a Certificate Authority list? |
waitForNegotiation | Should the function wait until the negotiation is complete before returning? |
certBuff | Buffer containing the certificate data |
certBuffSize | Size of the buffer containing the certificate data |
certBuffFormat | The format of the certificate buffer |
bIsClient | Perform the TLS negotiation as the Client and not the Server? |
timeout | The number of timeticks to wait for completion |
>0 | The file descriptor of the connected SSL socket |
<0 | The error code for the failure from SSL Error Codes or TCP Socket Status |
int SSL_negotiate | ( | int | tcpFd, |
const char * | common_name, | ||
bool | reuseSessionPort = true , |
||
bool | verifyPeer = false , |
||
const unsigned char * | certBuff = nullptr , |
||
uint32_t | certBuffSize = 0 , |
||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM , |
||
bool | bIsClient = true |
||
) |
Executes the TLS negotiation over a given socket, to establish a secure communication channel through that socket.
tcpFd | The TCP file descriptor to associate the connection with. |
*common_name | The comman name to use for checking certificate validity passing in NULL will accept any connection. |
reuseSessionPort | Should we look at the port for reuse lookup? |
verifyPeer | Should the client verify the server's certificate against a Certificate Authority list? |
certBuff | Buffer containing the certificate data |
certBuffSize | Size of the buffer containing the certificate data |
certBuffFormat | The format of the certificate buffer |
bIsClient | Perform the TLS negotiation as the Client and not the Server? |
>0 | The file descriptor of the connected SSL socket |
<0 | The error code for the failure from SSL Error Codes or TCP Socket Status |
void SSL_ServerReadyCert | ( | const unsigned char * | cert, |
const unsigned char * | key, | ||
uint16_t | certBuffFormat = SSL_FILETYPE_PEM |
||
) |
Add a key and certificate to the server.
cert | Pointer to the buffer holding the PEM certificate data |
key | Pointer to the buffer holding the PEM key data |
certBuffFormat | The format of the cert being passed in. Either SSL_FILETYPE_PEM or WOLFSSL_FILETYPE_ASN1. |
int SSL_setsockoption | ( | int | fd, |
int | option | ||
) |
Set SSL TCP socket options.
fd | Socket file descriptor. |
option | Socket option to set: TCP Socket Options. |
uint16_t SSLGetRxBufferSpaceUsed | ( | int | fd | ) |
Returns the amount of data buffered to be read from the socket.
fd | The socket's file descriptor |
>=0 | The number of bytes available to be read |
< | 0 The requested socket does not exist |
uint16_t SSLGetTxBufferAvailSpace | ( | int | fd | ) |
Returns the amount of data buffered to be read from the socket.
fd | The socket's file descriptor |
>=0 | The number of bytes available to be read |
< | 0 The requested socket does not exist |
void SslInit | ( | ) |
This function initializes the SSL library.
Note: It should only be called in the case that you want to verify peer certificates as a client and need to add the certificates individually. Otherwise, calls to SSL_connect() will automatically call this function for you.
int SSLReadWithTimeout | ( | int | fd, |
char * | cp, | ||
int | size, | ||
uint32_t | timeout | ||
) |
SSL mirror of the ReadWithTiemout() function.
This function will block until either the time-out expires or at least one byte is available to be read. This function can be used to read from stdio, TCP sockets, or Serial ports.
Important: This function operates like a read function in that it reads all available bytes and returns. The addition of a time-out does not cause the function to block until the maximum number of bytes specified in the function call is available. The application must use the return value of the function to determine how many bytes were read, and call the function again if necessary.
fd | The file descriptor number. |
*cp | A pointer to the read destination. |
size | Maximum number of bytes to read. |
timeout | The number of timer ticks to wait for data. |
0 | Invalid buf or size parameters were passed |
>0 | The number of bytes read |
TCP_ERR_TIMEOUT | No bytes were read before timeout |
TCP_ERR_CLOSING | TCP connection is no longer valid, or the SSLSocket_Record no longer exists |
void SslSetVerifyPeerClient | ( | bool | verifyPeer | ) |
Sets whether or not verify peer should be enabled on the global SSL client context.
verifyPeer | True if verify should be enabled, or false otherwise. |
void SslSetVerifyPeerServer | ( | bool | verifyPeer | ) |
Sets whether or not verify peer should be enabled on the global SSL server context.
verifyPeer | True if verify should be enabled, or false otherwise. |
bool SSLSocketsAvail | ( | ) |
Returns whether or not there are any sockets available.
true | If there are sockets available. |
false | If there are not any sockets available |
|
extern |
Returns whether or not a file descriptor is an SSL file descriptor.
This function is used to determine if the fd is an SSL connection. It can be used by things like the callback functions of the web server to determine how secure the fd is before sending sensitive information over it.
fd | The file descriptor to test. |
TRUE | If it is an SSL fd |
FALSE | If it is not an SSL fd or if there was an error |
|
extern |
Returns the TCP file descriptor associated with an SSL socket file descriptor.
sslSocketFd | The socket file descriptor. |
|
extern |
Return the network interface associated with an SSL TCP socket.
fd | The socket file descriptor. |
|
extern |
Returns the local address of this connected socket.
This function is used to retrieve the local address of an SSL fd. This function will also work correctly if you pass in an fd that is a TCP connection. This allows you to use one set of code for both normal TCP and SSL connections.
fd | The file descriptor to test. |
|
extern |
Returns the local port of this connected socket.
This function is used to retrieve the local port of an SSL fd. This function will also work correctly if you pass in an fd that is a TCP connection. This allows you to use one set of code for both normal TCP and SSL connections.
fd | The file descriptor to test. |
|
extern |
Returns the remote address of this connected socket.
This function is used to retrieve the remote address of an SSL fd. This function will also work correctly if you pass in an fd that is a TCP connection. This allows you to use one set of code for both normal TCP and SSL connections.
fd | The file descriptor to test. |
|
extern |
Returns the remote port of this connected socket.
This function is used to retrieve the remote port of an SSL fd. This function will also work correctly if you pass in an fd that is a TCP connection. This allows you to use one set of code for both normal TCP and SSL connections.
fd | The file descriptor to test. |
|
extern |
Returns the number of re-transmits that have occurred on the specified SSL connection.
i | The socket file descriptor. |
|
extern |
SSL mirror of TcpGetLastRxTime().
fd | The socket file descriptor. |
|
extern |
Return the current state of a SSL TCP socket.
fd | Socket file descriptor. |
|
extern |
SSL mirror of TcpSendKeepAlive().
fd | The socket file descriptor. |