TrustCore SDK NanoSSL API reference  version 7.0
Asynchronous Client and Server Functions

Asynchronous NanoSSL client and server functions. More...

Functions

MOC_EXTERN sbyte4 SSL_ASYNC_closeConnection (sbyte4 connectionInstance)
 Close an SSL session and release resources. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_freeSendBufferZeroCopy (sbyte4 connectionInstance, ubyte4 numUnusedBytes)
 Get a pointer reference to the connection's send data buffer. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_getRecvBuffer (sbyte4 connectionInstance, ubyte **data, ubyte4 *len, ubyte4 *pRetProtocol)
 Get a pointer to the connection's receive data buffer (the socket buffer itself). More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_getRecvPending (sbyte4 connectionInstance, sbyte4 *len)
 Get number of bytes to read. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_getSendBuffer (sbyte4 connectionInstance, ubyte *data, ubyte4 *len)
 Get a copy of the connection's send data buffer. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_getSendBufferZeroCopy (sbyte4 connectionInstance, ubyte **data, ubyte4 *len)
 Get a pointer reference to the connection's send data buffer. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_init (sbyte4 numServerConnections, sbyte4 numClientConnections)
 Initialize NanoSSL client or server internal structures. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_recvMessage (sbyte4 connectionInstance, ubyte *pBytesReceived, ubyte4 numBytesReceived)
 Get a copy of data received from a connected server/client. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_recvMessage2 (sbyte4 connectionInstance, ubyte *pBytesReceived, ubyte4 numBytesReceived, ubyte **ppRetBytesReceived, ubyte4 *pRetNumRxBytesRemaining)
 Get a pointer to the connection's most recently receiveed message. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_sendMessage (sbyte4 connectionInstance, sbyte *pBuffer, sbyte4 bufferSize, sbyte4 *pBytesSent)
 Send data to a connected server/client. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_sendMessagePending (sbyte4 connectionInstance)
 Determines whether there is data in a connection instance's SSL send buffer. More...
 
MOC_EXTERN sbyte4 SSL_bindMbedtlsShimMethods (mssl_methods_t *pMeth)
 Binds NanoSSL functions to be used by NanoSSL Shim layer. More...
 
MOC_EXTERN sbyte4 SSL_bindShimMethods (nssl_methods_t *pMeth)
 Binds NanoSSL functions to be used by NanoSSL Shim layer. More...
 
MOC_EXTERN sbyte4 SSL_in_accept_init_moc (sbyte4 connectionInstance)
 Checks if server accepts a secure connection. More...
 
MOC_EXTERN sbyte4 SSL_in_connect_init_moc (sbyte4 connectionInstance)
 Checks if the connection instance can be connected to. More...
 
MOC_EXTERN sbyte4 SSL_isSecureConnectionEstablished (sbyte4 connectionInstance)
 Checks if a secure connection has been established. More...
 
MOC_EXTERN sbyte4 SSL_OSSL_AddIdenCertChain (void *pCertStore, OSSL_SizedBuffer *certs, unsigned numCerts, const u_int8_t *pKeyBlob, unsigned keyBlobLength, ubyte *pAlias, ubyte4 aliasLen)
 Add an x509v3 certificate identity to the Digicert SoT Platform certificate store. More...
 
MOC_EXTERN sbyte4 SSL_OSSL_AddTrustPoint (void *pCertStore, u_int8_t *pDerBuf, int derLen)
 Add a trust point to a Digicert SoT Platform certificate store. More...
 
MOC_EXTERN sbyte4 SSL_OSSL_DSAParamsToKeyBlob (OSSL_DSAParams *pD, void **ppKeyBlob, unsigned int *pBlobLen)
 Convert DSA private key into Mocana's internal KeyBlob format. More...
 
MOC_EXTERN sbyte4 SSL_OSSL_ECCParamsToKeyBlob (OSSL_ECCParams *pEParams, void *ppKeyBlob, unsigned int *pBlobLen)
 Convert ECC private key into Mocana's internal KeyBlob format. More...
 
MOC_EXTERN sbyte4 SSL_OSSL_RSAParamsToKeyBlob (OSSL_RSAParams *pR, void **ppKeyBlob, unsigned int *pBlobLen)
 Convert RSA private key into Mocana's internal KeyBlob format. More...
 

Detailed Description

See also
Asynchronous Client Functions
Asynchronous Server Functions
Core (Async and Sync) Client Functions
Core (Async and Sync) Client and Server Functions
Core (Async and Sync) Server Functions

Function Documentation

◆ SSL_ASYNC_closeConnection()

MOC_EXTERN sbyte4 SSL_ASYNC_closeConnection ( sbyte4  connectionInstance)

This function closes an asynchronous SSL session and releases all the resources that are managed by the NanoSSL client/server.

Since
1.41
Version
1.41 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Note
This function does not close sockets or TCBs (transmission control blocks). Your integration code should explicitly close all TCP/IP sockets and TCBs.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_freeSendBufferZeroCopy()

MOC_EXTERN sbyte4 SSL_ASYNC_freeSendBufferZeroCopy ( sbyte4  connectionInstance,
ubyte4  numUnusedBytes 
)

This function is used to indicate how many bytes of the most recently produced send data buffer was consumed by the caller. This call typically follows the call to SSL_ASYNC_getSendBufferZeroCopy() that returns the pointer to the send data buffer that is waiting to be transmitted. If numUnusedBytes is 0, then the send data buffer is freed. If it is not zero, then that much data is retained and the next call to SSL_ASYNC_getSendBufferZeroCopy() will return the saved data. This call is suitable for Zero-Copy implementations.

Since
1.41
Version
7.0 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect() or SSL_ASYNC_accept().
numUnusedBytesA ubyte4 value that indicates how many bytes is left over from the data buffer obtained from a previous call to SSL_ASYNC_getSendBufferZeroCopy().
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_getRecvBuffer()

MOC_EXTERN sbyte4 SSL_ASYNC_getRecvBuffer ( sbyte4  connectionInstance,
ubyte **  data,
ubyte4 *  len,
ubyte4 *  pRetProtocol 
)

This function returns a pointer (through the data parameter) to the specified connection's most recently received data buffer (the socket buffer itself).

Since
1.41
Version
1.41 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
dataOn return, pointer to the address of the connection's receive buffer.
lenOn return pointer to number of bytes in data.
pRetProtocolOn return, the SSL protocol type for data (usually 23 == SSL Application Data)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_getRecvPending()

MOC_EXTERN sbyte4 SSL_ASYNC_getRecvPending ( sbyte4  connectionInstance,
sbyte4 *  len 
)

This function returns the the number of bytes needed to be read.

Since
1.41
Version
7.0 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect() or SSL_ASYNC_accept().
lenPass in a pointer to a sbyte4. On return this contains the number of bytes to be read
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_getSendBuffer()

MOC_EXTERN sbyte4 SSL_ASYNC_getSendBuffer ( sbyte4  connectionInstance,
ubyte *  data,
ubyte4 *  len 
)

This function returns a copy (through the data parameter) of the specified connection's most recently sent data buffer.

Since
1.41
Version
6.4 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
dataOn return, pointer to the buffer containing the data in the connection's send buffer.
lenOn return pointer to number of bytes in data.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_getSendBufferZeroCopy()

MOC_EXTERN sbyte4 SSL_ASYNC_getSendBufferZeroCopy ( sbyte4  connectionInstance,
ubyte **  data,
ubyte4 *  len 
)

This function returns the pointer (through the data parameter) of the specified connection's most recently sent data buffer. It is suitable for Zero-Copy implementations. After the caller gets the pointer and transmits all (or some) of the data, it must call SSL_ASYNC_freeSendBufferZeroCopy() to indicate how much of data still remains to be transmitted before it makes another call to SSL_ASYNC_getSendBuffer() to send fresh data.

Since
1.41
Version
7.0 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect() or SSL_ASYNC_accept().
dataOn return, contains the address of the buffer containing the data in the connection's send buffer. i.e *data has the pointer to the connection's send buffer)
lenPass in a pointer to a ubyte4. On return this contains the number of bytes in the connection's send buffer (i.e data)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_init()

MOC_EXTERN sbyte4 SSL_ASYNC_init ( sbyte4  numServerConnections,
sbyte4  numClientConnections 
)

This function initializes NanoSSL client/server internal structures. Your application should call this function before starting the HTTPS and application servers.

Since
1.41
Version
1.41 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
numServerConnectionsMaximum number of SSL/TLS server connections to allow. (Each connection requires only a few bytes of memory.) If operating in dual mode, this is the sum of the synchronous and asynchronous server connections.
numClientConnectionsMaximum number of SSL/TLS client connections to allow. If operating in dual mode, this is the sum of the synchronous and asynchronous client connections.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_recvMessage()

MOC_EXTERN sbyte4 SSL_ASYNC_recvMessage ( sbyte4  connectionInstance,
ubyte *  pBytesReceived,
ubyte4  numBytesReceived 
)

This function retrieves data from a connected server/client and copies it into a new buffer. It should be called from your TCP/IP receive upcall handler, or from your application after reading a packet of data. The engine decrypts and processes the packet, and then calls NanoSSL server's upcall function, funcPtrReceiveUpcall, to hand off the decrypted data.

Since
1.41
Version
1.41 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect.
pBytesReceivedOn return, pointer to the packet or message received from the TCP/IP stack.
numBytesReceivedOn return, number of bytes in pBytesReceived.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Note
This function is provided for backward compatibility with earlier Embedded SSL/TLS implementations. New NanoSSL implementations should use SSL_ASYNC_recvMessage2(). The SSL_ASYNC_recvMessage2() function returns a pointer to the full data buffer, eliminating the need to consider maximum buffer sizes and manage multiple read calls.

(revise the note that refers to "earlier Embedded SSL/TLS implementations", which is quite old relative to the DSF/SoTP usage)

Remarks
This function is applicable to asynchronous clients and servers.
while ((OK == status) && (TRUE != mBreakServer))
{
if (OK <= (status = TCP_READ_AVL(socketClient,
pInBuffer,
SSH_SYNC_BUFFER_SIZE,
&numBytesRead,
20000)))
{
if (0 != numBytesRead)
status = SSL_ASYNC_recvMessage(connInstance,
pInBuffer,
numBytesRead);
}
if (ERR_TCP_READ_TIMEOUT == status)
status = OK;
}

ssl.c

◆ SSL_ASYNC_recvMessage2()

MOC_EXTERN sbyte4 SSL_ASYNC_recvMessage2 ( sbyte4  connectionInstance,
ubyte *  pBytesReceived,
ubyte4  numBytesReceived,
ubyte **  ppRetBytesReceived,
ubyte4 *  pRetNumRxBytesRemaining 
)

This function returns a pointer (through the pBytesReceived parameter) to the specified connection's most recently received message. Typically, you'll call this function and then, if the returned number of bytes of application data is greater than 0, call SSL_ASYNC_getRecvBuffer() to get the pointer to the decrypted data.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_API_EXTENSIONS__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
pBytesReceivedOn return, pointer to the packet or message received from the TCP/IP stack.
numBytesReceivedOn return, number of bytes in pBytesReceived.
ppRetBytesReceivedOn return, pointer to buffer containing number of bytes remaining to be read.
pRetNumRxBytesRemainingOn return, pointer to number of bytes in ppRetBytesReceived.
Returns
Value >= 0 is the number of bytes of application data available when the SSL_FLAG_ENABLE_RECV_BUFFER is set; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_ASYNC_sendMessage()

MOC_EXTERN sbyte4 SSL_ASYNC_sendMessage ( sbyte4  connectionInstance,
sbyte *  pBuffer,
sbyte4  bufferSize,
sbyte4 *  pBytesSent 
)

This function sends data to a connected server/client. It should not be called until a secure SSL connection is established between the client and server.

Since
1.41
Version
6.4 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect.
pBufferPointer to buffer containing the data to send.
bufferSizeNumber of bytes in pBuffer.
pBytesSentOn return, pointer to number of bytes successfully sent.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Note
This function should not be called until after a funcPtrOpenStateUpcall upcall event.
Remarks
This function is applicable to asynchronous clients and servers.
static void SSL_EXAMPLE_helloWorld(int connectionInstance)
{
sbyte4 bytesSent = 0;
sbyte4 status;
status = SSL_ASYNC_sendMessage(connInstance,
"hello world!", 12,
&bytesSent);
}

ssl.c

◆ SSL_ASYNC_sendMessagePending()

MOC_EXTERN sbyte4 SSL_ASYNC_sendMessagePending ( sbyte4  connectionInstance)

This function determines whether there is data in a connection instance's SSL send buffer. If the send buffer is empty, the function returns zero (0) as its status. If send data is pending, an attempt is made to send the data, and the subsequent number of bytes remaining to be sent is returned as the function status. (A function return value of zero (0) indicates that the send was successful and that no data remains in the send buffer.)

Since
1.41
Version
3.06 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
Returns
OK (0) if the send buffer is empty or if this function successfully sent all remaining buffer data; otherwise the number of bytes remaining to be sent.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_bindMbedtlsShimMethods()

MOC_EXTERN sbyte4 SSL_bindMbedtlsShimMethods ( mssl_methods_t *  pMeth)

This function is used to bind NanoSSL functions to be used as callback functions in an internal data structure so that NanoSSL functions are used under the hood of the Shim layer.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

Additionally, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_MBEDTLS_SHIM__

ssl.h

Parameters
pMethPointer to data structure that stores the NanoSSL functions.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_bindShimMethods()

MOC_EXTERN sbyte4 SSL_bindShimMethods ( nssl_methods_t *  pMeth)

This function is used to bind NanoSSL functions to be used as callback functions in an internal data structure so that NanoSSL functions are used under the hood of the Shim layer.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

Additionally, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_OPENSSL_SHIM__

ssl.h

Parameters
pMethPointer to data structure that stores the NanoSSL functions.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_in_accept_init_moc()

MOC_EXTERN sbyte4 SSL_in_accept_init_moc ( sbyte4  connectionInstance)

This function is needed to get Apache MOD_SSL to work over NanoSSL instead of OpenSSL. The function checks if the connection instance can accept a secure connection from clients.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_CLIENT__
  • __ENABLE_MOCANA_SSL_SERVER__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
Returns
OK (0) if successful; otherwise, returns 1 (not successful).
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_in_connect_init_moc()

MOC_EXTERN sbyte4 SSL_in_connect_init_moc ( sbyte4  connectionInstance)

This function is needed to get Apache MOD_SSL to work over NanoSSL instead of OpenSSL. The function checks if the connection instance is open to allow clients to connect to it.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_CLIENT__
  • __ENABLE_MOCANA_SSL_SERVER__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
Returns
OK (0) if successful; otherwise, returns 1 (not successful).
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_isSecureConnectionEstablished()

MOC_EXTERN sbyte4 SSL_isSecureConnectionEstablished ( sbyte4  connectionInstance)

This function is needed to get Apache MOD_SSL to work over NanoSSL instead of OpenSSL. The function checks whether the connection instance is a secure connection.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_CLIENT__
  • __ENABLE_MOCANA_SSL_SERVER__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_ASYNC_connect().
Returns
OK (0) if successful; otherwise, returns 1 (not successful).
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_OSSL_AddIdenCertChain()

MOC_EXTERN sbyte4 SSL_OSSL_AddIdenCertChain ( void *  pCertStore,
OSSL_SizedBuffer *  certs,
unsigned  numCerts,
const u_int8_t *  pKeyBlob,
unsigned  keyBlobLength,
ubyte *  pAlias,
ubyte4  aliasLen 
)

This function allocates space to the Digicert SoT Platform certificate store and adds a valid x509v3 certificate to it. The certificate is verified with its private key and is also indexed based on key type.

certificate store

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__ n Additionally, the following flag must be defined in moptions.h:
  • __ENABLE_MOCANA_OPENSSL_SHIM__

ssl.h

Parameters
pCertStorePointer to the SoT Platform certificate store that contains the SSL connection's certificates.
certsPointer to the buffer that holds certificate data.
numCertsNumber of certificates in SoT Platform certificate store.
ppKeyBlobOn return, pointer to the converted KeyBlob.
pBlobLenOn return, pointer to the length of the KeyBlob.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_OSSL_AddTrustPoint()

MOC_EXTERN sbyte4 SSL_OSSL_AddTrustPoint ( void *  pCertStore,
u_int8_t *  pDerBuf,
int  derLen 
)

This function adds a trust point to a Digicert SoT Platform certificate store.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

Additionally, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_OPENSSL_SHIM__

ssl.h

Parameters
pCertStorePointer to the SoT Platform certificate store to which to add the trust point.
pDerBufPointer to the trust point to add.
derLenNumber of bytes in the trust point.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_OSSL_DSAParamsToKeyBlob()

MOC_EXTERN sbyte4 SSL_OSSL_DSAParamsToKeyBlob ( OSSL_DSAParams *  pD,
void **  ppKeyBlob,
unsigned int *  pBlobLen 
)

This function is called by the NanoSSL Shim layer to create an DSA private key and use the RSA parameters given to convert it into Mocana's internal KeyBlob format.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

Additionally, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_OPENSSL_SHIM__
  • __ENABLE_MOCANA_DSA__

ssl.h

Parameters
pDPointer to the DSA parameters.
ppKeyBlobOn return, pointer to the converted KeyBlob.
pBlobLenOn return, pointer to the length of the KeyBlob.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_OSSL_ECCParamsToKeyBlob()

MOC_EXTERN sbyte4 SSL_OSSL_ECCParamsToKeyBlob ( OSSL_ECCParams *  pEParams,
void *  ppKeyBlob,
unsigned int *  pBlobLen 
)

This function is called by the NanoSSL Shim layer to create an DSA private key and use the EC parameters given to convert it into Mocana's internal KeyBlob format.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

Additionally, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_OPENSSL_SHIM__
  • __ENABLE_MOCANA_ECC__

ssl.h

Parameters
pEParamsPointer to the ECC parameters.
ppKeyBlobOn return, pointer to the converted KeyBlob.
pBlobLenOn return, pointer to the length of the KeyBlob.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c

◆ SSL_OSSL_RSAParamsToKeyBlob()

MOC_EXTERN sbyte4 SSL_OSSL_RSAParamsToKeyBlob ( OSSL_RSAParams *  pR,
void **  ppKeyBlob,
unsigned int *  pBlobLen 
)

This function is called by the NanoSSL Shim layer to create an RSA private key and use the RSA parameters given to convert it into Mocana's internal KeyBlob format.

Since
6.5
Version
6.5 and later

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__

Additionally, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_OPENSSL_SHIM__

ssl.h

Parameters
pRPointer to the RSA parameters.
ppKeyBlobOn return, pointer to the converted KeyBlob.
pBlobLenOn return, pointer to the length of the KeyBlob.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to asynchronous clients and servers.

ssl.c