TrustCore SDK NanoSSL API reference  version 7.0
ssl.h File Reference

NanoSSL and NanoDTLS developer API header. More...

Go to the source code of this file.

Data Structures

struct  peerDescr
 
struct  pemPasswordInfo
 
struct  ResponderID
 
struct  SrtpProfileInfo
 
struct  sslSettings
 Configuration settings and callback function pointers for NanoSSL SSL/TLS clients and NanoDTLS DTLS clients. More...
 

Typedefs

typedef MSTATUS(* funcPtrPasswordCallback) (void *pCallbackInfo, ubyte *pBuffer, ubyte4 bufferLen, ubyte4 *pOutLen)
 
typedef sbyte4(* SSLTransportRecv) (sbyte4 sslId, sbyte *pRetBuffer, ubyte4 bufferSize, ubyte4 *pNumBytesReceived, ubyte4 timeout)
 
typedef sbyte4(* SSLTransportSend) (sbyte4 sslId, sbyte *pBuffer, ubyte4 bufferLen, ubyte4 *pRetNumBytesSent)
 

Enumerations

enum  CertificateStatusType { certStatusType_ocsp = 1 }
 
enum  dataState { clientEarlyData = 0, serverHandshakeData, clientHandshakeData }
 
enum  E_HeartbeatExtension { noHeartbeatMessages = 0, peerAllowedToSend, peerNotAllowedToSend }
 
enum  hashType {
  sha1 = 0, sha224, sha256, sha384,
  sha512, md5, intrinsic = 8
}
 
enum  InnerAppType { SSL_INNER_APPLICATION_DATA =0, SSL_INNER_INTER_FINISHED =1, SSL_INNER_FINAL_FINISHED =2 }
 
enum  keyUpdateRequest { keyUpdateRequest_not_requested = 0, keyUpdateRequest_requested = 1, keyUpdate_none = 255 }
 
enum  NameTypeSNI { nameTypeHostName = 0 }
 
enum  tls13KDFKeyType {
  earlySecret = 0, binderKey, clientEarlyTrafficSecret, earlyExporterMasterSecret,
  handshakeSecret, clientHandshakeTrafficSecret, serverHandshakeTrafficSecret, masterSecret,
  clientApplicationTrafficSecret0, serverApplicationTrafficSecret0, exporterMasterSecret, resumptionMasterSecret
}
 
enum  TLS_HashAlgorithm {
  TLS_NONE = 0, TLS_MD5 = 1, TLS_SHA1 = 2, TLS_SHA224 = 3,
  TLS_SHA256 = 4, TLS_SHA384 = 5, TLS_SHA512 = 6, TLS_INTRINSIC = 8,
  TLS_PRIVATE = 254, TLS_HASH_MAX = 255
}
 
enum  tlsExtensionTypes {
  tlsExt_server_name = 0, tlsExt_max_fragment_length = 1, tlsExt_client_certificate_url = 2, tlsExt_trusted_ca_keys = 3,
  tlsExt_truncated_hmac = 4, tlsExt_status_request = 5, tlsExt_supportedGroups = 10, tlsExt_ECPointFormat = 11,
  tlsExt_SRP = 12, tlsExt_supportedSignatureAlgorithms = 13, dtlsExt_use_srtp = 14, tlsExt_heartbeat = 15,
  tlsExt_applicationLayerProtocolNegotiation = 16, tlsExt_signed_certificate_timestamp = 18, tlsExt_certificate_type = 19, tlsExt_server_certificate_type = 20,
  tlsExt_encrypt_then_mac = 22, tlsExt_extendedMasterSecret = 23, tlsExt_ticket = 35, tlsExt_pre_shared_key = 41,
  tlsExt_early_data = 42, tlsExt_supported_versions = 43, tlsExt_cookie = 44, tlsExt_psk_key_exchange_modes = 45,
  tlsExt_certificateAuthorities = 47, tlsExt_oidFilters = 48, tlsExt_postHandshakeAuth = 49, tlsExt_signatureAlgorithmCerts = 50,
  tlsExt_key_share = 51, tlsExt_nextProtocolNegotiation = 13172, tlsExt_innerApplication = 37703, tlsExt_renegotiated_connection = 0xff01
}
 
enum  tlsExtNamedCurves {
  tlsExtNamedCurves_secp192r1 = 0x0013, tlsExtNamedCurves_secp224r1 = 0x0015, tlsExtNamedCurves_secp256r1 = 0x0017, tlsExtNamedCurves_secp384r1 = 0x0018,
  tlsExtNamedCurves_secp521r1 = 0x0019, tlsExtNamedCurves_x25519 = 0x001D, tlsExtNamedCurves_x448 = 0x001E, tlsExtNamedCurves_ffdhe2048 = 0x0100,
  tlsExtNamedCurves_ffdhe3072 = 0x0101, tlsExtNamedCurves_ffdhe4096 = 0x0102, tlsExtNamedCurves_ffdhe6144 = 0x0103, tlsExtNamedCurves_ffdhe8192 = 0x0104,
  tlsExtHybrid_p256_kyber512 = 0xFE05, tlsExtHybrid_p256_kyber512_90s = 0xFE06, tlsExtHybrid_p256_ntru_hps_2048_677 = 0xFE07, tlsExtHybrid_p256_ntru_hrss_701 = 0xFE08,
  tlsExtHybrid_p256_lightsaber = 0xFE09, tlsExtHybrid_p384_kyber512_768 = 0xFE0A, tlsExtHybrid_p384_kyber_768_90s = 0xFE0B, tlsExtHybrid_p384_ntru_hps_4096_821 = 0xFE0C,
  tlsExtHybrid_p384_saber = 0xFE0D, tlsExtHybrid_p521_kyber_1024 = 0xFE0E, tlsExtHybrid_p521_kyber_1024_90s = 0xFE0F, tlsExtHybrid_p521_firesaber = 0xFE10
}
 
enum  tlsExtPskKeyExchangeMode { psk_ke = 0, psk_dhe_ke = 1 }
 

Functions

MOC_EXTERN sbyte4 CERT_STORE_createStoreAlt (void **ppNewStore)
 Wrapper function to create and initialize a Digicert SoT Platform certificate store. More...
 
MOC_EXTERN MSTATUS CERT_STORE_releaseStoreAlt (void **ppReleaseStore)
 Wrapper function to release (free) memory used by a Digicert SoT Platform certificate store. More...
 
MOC_EXTERN sbyte4 DTLS_isTimerExpired (sbyte4 connectionInstance)
 Check if DTLS timer has expired. More...
 
MOC_EXTERN sbyte4 SSL_acceptConnection (TCP_SOCKET tempSocket, struct certStore *pCertStore)
 Create a synchronous server connection context. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_acceptConnection (TCP_SOCKET tempSocket, struct certStore *pCertStore)
 Register a secure asynchronous SSL/TLS connection. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_acceptConnectionAlt (TCP_SOCKET tempSocket, void *pCertStore)
 Wrapper function to register a secure asynchronous SSL/TLS connection. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_closeConnection (sbyte4 connectionInstance)
 Close an SSL session and release resources. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_connect (TCP_SOCKET tempSocket, ubyte sessionIdLen, ubyte *sessionId, ubyte *masterSecret, const sbyte *dnsName, struct certStore *pCertStore)
 Create an asynchronous client connection context. More...
 
MOC_EXTERN sbyte4 SSL_ASYNC_connectAlt (TCP_SOCKET tempSocket, ubyte sessionIdLen, ubyte *sessionId, ubyte *masterSecret, const sbyte *dnsName, void *certStore)
 Wrapper function to create an asynchronous client connection context. 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_initEx (sbyte4 numServerConnections, sbyte4 numClientConnections, RNGFun rngFun, void *rngArg)
 
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_ASYNC_start (sbyte4 connectionInstance)
 Start establishing a secure client-server connection. 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_checkFIPS ()
 Check if FIPS library is loaded correctly. More...
 
MOC_EXTERN sbyte4 SSL_checkRehandshakeTimer (sbyte4 connectionInstance)
 Timer check for rehandshaking. More...
 
MOC_EXTERN MSTATUS SSL_CLIENT_setRetrievePSKCallback (sbyte4 connectionInstance, sbyte4(*cb)(sbyte4 connectionInstance, sbyte *ServerInfo, ubyte4 serverInfoLen, void *userData, void **ppPSKs, ubyte2 *pNumPSKs, ubyte *selectedIndex, intBoolean *pFreeMemory))
 
MOC_EXTERN sbyte4 SSL_closeConnection (sbyte4 connectionInstance)
 Close an SSL session and release resources. More...
 
MOC_EXTERN sbyte4 SSL_connect (TCP_SOCKET tempSocket, ubyte sessionIdLen, ubyte *sessionId, ubyte *masterSecret, const sbyte *dnsName, struct certStore *certStore)
 Create a synchronous client connection context. More...
 
MOC_EXTERN MSTATUS SSL_decryptPKCS8PemKey (ubyte *pContent, ubyte4 contentLength, AsymmetricKey **pKey, void *pPwInfo, intBoolean base64)
 
MOC_EXTERN MSTATUS SSL_deserializePSK (ubyte *pPsk, ubyte4 pskLen, tls13PSK **ppRetPsk)
 Deserialize TLS 1.3 PSK. More...
 
MOC_EXTERN sbyte4 SSL_disableCipherHashAlgorithm (sbyte4 connectionInstance, TLS_HashAlgorithm hashId)
 Disable ciphers using the specified hash algorithm (and lower). More...
 
MOC_EXTERN sbyte4 SSL_DTLS_getTimeout (sbyte4 connectionInstance, void *pTime)
 Get the time remaing until DTLS timeout. More...
 
MOC_EXTERN sbyte4 SSL_DTLS_start (sbyte4 connectionInstance)
 
MOC_EXTERN sbyte4 SSL_enableCiphers (sbyte4 connectionInstance, const ubyte2 *pCipherSuiteList, ubyte4 listLength)
 Enable specified ciphers. More...
 
MOC_EXTERN sbyte4 SSL_enableECCCurves (sbyte4 connectionInstance, enum tlsExtNamedCurves *pECCCurvesList, ubyte4 listLength)
 Enable ECC curves. More...
 
MOC_EXTERN MSTATUS SSL_enableHeartbeatSupport (sbyte4 connectionInstance, E_HeartbeatExtension value, sbyte4(*funcPtrHeatbeatMessageCallback)(sbyte4 connectionInstance, sbyte4 status, ubyte heartbeatType))
 
MOC_EXTERN sbyte4 SSL_enableSrtpProfiles (sbyte4 connectionInstance, ubyte2 *pSrtpProfileList, ubyte4 listLength)
 
MOC_EXTERN MSTATUS SSL_freePSK (tls13PSK **ppPsk)
 Free TLS 1.3 PSK. More...
 
MOC_EXTERN sbyte4 SSL_generateEAPFASTSessionKeys (sbyte4 connectionInstance, ubyte *S_IMCK, sbyte4 s_imckLen, ubyte *MSK, sbyte4 mskLen, ubyte *EMSK, sbyte4 emskLen)
 
MOC_EXTERN sbyte4 SSL_generateEarlyExportKeyMaterial (sbyte4 connectionInstance, ubyte *pKey, ubyte2 keyLen, ubyte *pLabel, ubyte2 labelLen, ubyte *pContext, ubyte4 contextLen)
 Generate export keying material based on the early exporter master secret, label, and context. More...
 
MOC_EXTERN sbyte4 SSL_generateExpansionKey (sbyte4 connectionInstance, ubyte *pKey, ubyte2 keyLen, ubyte *keyPhrase, ubyte2 keyPhraseLen)
 
MOC_EXTERN sbyte4 SSL_generateExportKeyMaterial (sbyte4 connectionInstance, ubyte *pKey, ubyte2 keyLen, ubyte *pKeyphrase, ubyte2 keyPhrase, ubyte *pContext, ubyte2 contextLen, int useContext)
 Generate the export key material with the given label and context for a connection. More...
 
MOC_EXTERN sbyte4 SSL_generateTLSExpansionKey (sbyte4 connectionInstance, ubyte *pKey, ubyte2 keyLen, ubyte *keyPhrase, ubyte2 keyPhraseLen)
 
MOC_EXTERN sbyte4 SSL_getCipherInfo (sbyte4 connectionInstance, ubyte2 *pCipherId, ubyte4 *pPeerEcCurves)
 Get a connection's ciphers and ecCurves. More...
 
MOC_EXTERN sbyte4 SSL_getCipherList (sbyte4 connectionInstance, ubyte2 **ppCipherIdList, ubyte4 *pCount)
 Get the enabled ciphers. More...
 
MOC_EXTERN sbyte4 SSL_getClientSessionInfo (sbyte4 connectionInstance, ubyte *sessionIdLen, ubyte sessionId[SSL_MAXSESSIONIDSIZE], ubyte masterSecret[SSL_MASTERSECRETSIZE])
 Get connection instance's identifying information. More...
 
MOC_EXTERN sbyte4 SSL_getClientSRPIdentity (sbyte4 connectionInstance, const ubyte **identity, ubyte4 *identityLength)
 
MOC_EXTERN sbyte4 SSL_getCookie (sbyte4 connectionInstance, void **pCookie)
 Get custom information for a connection instance. More...
 
ubyte4 SSL_getCurveIdOfNamedCurve (ubyte2 namedCurve)
 
MOC_EXTERN sbyte4 SSL_getEAPFAST_CHAPChallenge (sbyte4 connectionInstance, ubyte *challenge, ubyte4 challengeLen)
 
MOC_EXTERN sbyte4 SSL_getEAPFAST_IntermediateCompoundKey (sbyte4 connectionInstance, ubyte *s_imk, ubyte *msk, ubyte mskLen, ubyte *imk)
 
MOC_EXTERN sbyte4 SSL_getInstanceFromSocket (TCP_SOCKET socket)
 Get a socket's connection instance. More...
 
MOC_EXTERN sbyte4 SSL_getLocalState (sbyte4 connectionInstance, sbyte4 *pState)
 Returns the last message sent. More...
 
MOC_EXTERN ubyte4 SSL_getMaxProtoVersion ()
 
MOC_EXTERN ubyte4 SSL_getMinProtoVersion ()
 
ubyte2 SSL_getNamedCurveOfCurveId (ubyte4 curveId)
 
MOC_EXTERN sbyte4 SSL_getPeerDescr (sbyte4 connectionInstance, const peerDescr **ppRetPeerDescr)
 
MOC_EXTERN sbyte4 SSL_getProtoVersion (sbyte4 connectionInstance)
 
MOC_EXTERN sbyte4 SSL_getSelectedApplicationProtocol (sbyte4 connectionInstance, const ubyte **selectedApplicationProtocol, ubyte4 *selectedApplicationProtocolLen)
 Retrieve the selected Application Layer Protocol. More...
 
MOC_EXTERN sbyte4 SSL_getSessionFlags (sbyte4 connectionInstance, ubyte4 *pRetFlagsSSL)
 Get a connection's context (its flags). More...
 
MOC_EXTERN sbyte4 SSL_getSessionInfo (sbyte4 connectionInstance, ubyte *sessionIdLen, ubyte sessionId[SSL_MAXSESSIONIDSIZE], ubyte masterSecret[SSL_MASTERSECRETSIZE])
 
MOC_EXTERN sbyte4 SSL_getSessionStatus (sbyte4 connectionInstance, ubyte4 *pRetStatusSSL)
 Get a connection's status. More...
 
MOC_EXTERN sbyte4 SSL_getSessionStatusEx (sbyte4 connectionInstance, ubyte4 *pRetStatusSSL)
 
MOC_EXTERN MSTATUS SSL_getSharedSignatureAlgorithm (sbyte4 connectionInstance, ubyte4 algoListIndex, ubyte2 *pSigAlgo, ubyte isPeer)
 
MOC_EXTERN MSTATUS SSL_getSignatureAlgo (sbyte4 connectionInstance, ubyte2 *pSigAlg)
 
MOC_EXTERN sbyte4 SSL_getSocketId (sbyte4 connectionInstance, TCP_SOCKET *pRetSocket)
 Get a connection's socket identifier. More...
 
MOC_EXTERN sbyte4 SSL_getSSLTLSVersion (sbyte4 connectionInstance, ubyte4 *pVersion)
 Get a connection's SSL/TLS version. More...
 
MOC_EXTERN sbyte4 SSL_getState (sbyte4 connectionInstance, sbyte4 *pState)
 Return the last handshake message recived by the stack. More...
 
MOC_EXTERN sbyte4 SSL_getTlsUnique (sbyte4 connectionInstance, ubyte4 *pTlsUniqueLen, ubyte **ppTlsUnique)
 
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_init (sbyte4 numServerConnections, sbyte4 numClientConnections)
 Initialize NanoSSL client or server internal structures. More...
 
MOC_EXTERN sbyte4 SSL_InitAsymmetricKey (AsymmetricKey *pAsymKey)
 
MOC_EXTERN sbyte4 SSL_initEx (sbyte4 numServerConnections, sbyte4 numClientConnections, RNGFun rngFun, void *rngArg)
 
MOC_EXTERN sbyte4 SSL_initializeVersion ()
 
MOC_EXTERN sbyte4 SSL_initiateRehandshake (sbyte4 connectionInstance)
 Renegotiate an SSL/TLS session. More...
 
MOC_EXTERN MSTATUS SSL_INTERNAL_setConnectionState (sbyte4 connectionInstance, sbyte4 connectionState)
 
MOC_EXTERN sbyte4 SSL_ioctl (sbyte4 connectionInstance, ubyte4 setting, void *value)
 Enable dynamic management of a connection's features. More...
 
MOC_EXTERN sbyte4 SSL_isRehandshakeAllowed (sbyte4 connectionInstance, intBoolean *pRehandshake)
 Check if the rehandshake is allowed for the connection. More...
 
MOC_EXTERN sbyte4 SSL_isSecureConnectionEstablished (sbyte4 connectionInstance)
 Checks if a secure connection has been established. More...
 
MOC_EXTERN sbyte4 SSL_isSessionDTLS (sbyte4 connectionInstance)
 Determine whether a connection instance represents a DTLS server, a DTLS client, or an unrecognized connection (for example, SSH). More...
 
MOC_EXTERN sbyte4 SSL_isSessionSSL (sbyte4 connectionInstance)
 Determine whether a connection instance represents an SSL/TLS server, an SSL/TLS client, or an unrecognized connection (for example, SSH). More...
 
MOC_EXTERN sbyte4 SSL_lookupAlert (sbyte4 connectionInstance, sbyte4 lookupError, sbyte4 *pRetAlertId, sbyte4 *pAlertClass)
 Get the SSL alert code for a Mocana error. More...
 
MOC_EXTERN sbyte4 SSL_negotiateConnection (sbyte4 connectionInstance)
 Establish a secure SSL client-server connection. 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_AddIdenCertChainExtData (void *pCertStore, OSSL_SizedBuffer *certs, unsigned numCerts, const u_int8_t *pKeyBlob, unsigned keyBlobLength, ubyte *pAlias, ubyte4 aliasLen, ExtendedDataCallback extDataFunc, sbyte4 extDataIdentifier)
 
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...
 
MOC_EXTERN MSTATUS SSL_populateMutualAuthCertStore (sbyte4 connectionInstance, const SizedBuffer *pCerts, ubyte4 numCerts, ubyte *pKey, ubyte4 keyLen, const ubyte *pCACert, ubyte4 caCertLength)
 Function to populate the mutual auth cert store. More...
 
MOC_EXTERN sbyte4 SSL_PROXY_connect (TCP_SOCKET sslSocket, sbyte4 sslId, SSLTransportSend transportSend, SSLTransportRecv transportRecv, TCP_SOCKET tempSocket, ubyte sessionIdLen, ubyte *sessionId, ubyte *masterSecret, const sbyte *dnsName, struct certStore *certStore)
 Create a synchronous client connection context with transport handlers for creating a connection through an existing proxy server connection. More...
 
MOC_EXTERN sbyte4 SSL_recv (sbyte4 connectionInstance, sbyte *pRetBuffer, sbyte4 bufferSize, sbyte4 *pNumBytesReceived, ubyte4 timeout)
 Get data from a connected server/client. More...
 
MOC_EXTERN sbyte4 SSL_recvPending (sbyte4 connectionInstance, sbyte4 *pRetBooleanIsPending)
 Test if a connection instance's SSL receive buffer contains data. More...
 
MOC_EXTERN sbyte4 SSL_releaseTables (void)
 Release memory used by internal SSL/TLS memory tables. More...
 
MOC_EXTERN void * SSL_returnPtrToSSLSocket (sbyte4 connectionInstance)
 
MOC_EXTERN sbyte4 SSL_send (sbyte4 connectionInstance, sbyte *pBuffer, sbyte4 bufferSize)
 Send data to a connected server/client. More...
 
MOC_EXTERN sbyte4 SSL_sendAlert (sbyte4 connectionInstance, sbyte4 alertId, sbyte4 alertClass)
 Send an SSL alert message to an SSL peer. More...
 
MOC_EXTERN MSTATUS SSL_sendHeartbeatMessage (sbyte4 connectionInstance)
 
MOC_EXTERN sbyte4 SSL_sendInnerApp (sbyte4 connectionInstance, InnerAppType innerApp, ubyte *pMsg, ubyte4 msgLen, ubyte4 *retMsgLen)
 
MOC_EXTERN MSTATUS SSL_sendKeyUpdateRequest (sbyte4 connectionInstance, ubyte updateRequest)
 
MOC_EXTERN sbyte4 SSL_sendPending (sbyte4 connectionInstance, sbyte4 *pNumBytesPending)
 Determines whether there is data in a connection instance's SSL send buffer. More...
 
MOC_EXTERN MSTATUS SSL_sendPosthandshakeAuthCertificateRequest (sbyte4 connectionInstance)
 
MOC_EXTERN MSTATUS SSL_serializePSK (tls13PSK *pPsk, ubyte **ppPsk, ubyte4 *pPskLen)
 Serialize TLS 1.3 PSK. More...
 
MOC_EXTERN MSTATUS SSL_setAlertCallback (sbyte4 connectionInstance, sbyte4(*funcPtrAlertCallback)(sbyte4 connectionInstance, sbyte4 alertId, sbyte4 alertClass))
 Register an alert msg callback function. More...
 
MOC_EXTERN MSTATUS SSL_setAlpnCallback (sbyte4 connectionInstance, sbyte4(*funcPtrAlpnCallback)(sbyte4 connectionInstance, ubyte **out[], sbyte4 *outlen, ubyte *in, sbyte4 inlen))
 Register an Application Layer Protocol Negotiation callback. More...
 
MOC_EXTERN sbyte4 SSL_setApplicationLayerProtocol (sbyte4 connectionInstance, sbyte4 numNextProtocols, const char **nextProtocols)
 Set the Application Layer Protocol Negotiation information. More...
 
MOC_EXTERN MSTATUS SSL_setCertAndStatusCallback (sbyte4 connectionInstance, MSTATUS(*funcPtrGetCertAndStatusCallback)(sbyte4 connectionInstance, struct certChain *pCertChain, MSTATUS validationstatus))
 Provide Certificate and its validation status from the SSL stack. More...
 
MOC_EXTERN sbyte4 SSL_setCertifcateStatusRequestExtensions (sbyte4 connectionInstance, char **ppTrustedResponderCertPath, ubyte4 trustedResponderCertCount, extensions *pExts, ubyte4 extCount)
 
MOC_EXTERN MSTATUS SSL_setCertVerifySignCallback (sbyte4(*funcPtrMutualAuthCertificateVerify)(sbyte4 connectionInstance, const ubyte *pHash, ubyte4 hashLen, ubyte *pResult, ubyte4 resultLength))
 API to set the callback to compute signature for certificate verify message for client authentication. More...
 
MOC_EXTERN MSTATUS SSL_setCipherAlgorithm (sbyte4 connectionInstance, ubyte2 *pList, ubyte4 listLength, ubyte4 listType)
 Set cipher, supported Groups and signature algorithm. More...
 
MOC_EXTERN MSTATUS SSL_setClientCAList (SizedBuffer *pClientCAList, ubyte4 numClientCANames)
 Set the CA list that will be sent as part of Certificate Request message. More...
 
MOC_EXTERN MSTATUS SSL_setClientCertAuthorityCallback (sbyte4 connectionInstance, MSTATUS(*funcPtrClientCertAuthorityCallback)(sbyte4 connectionInstance, SizedBuffer *pCertAuthorities, ubyte4 certAuthorityCount))
 Provide certificate authorities to SSL stack for client. More...
 
MOC_EXTERN MSTATUS SSL_setClientCertCallback (sbyte4 connInstance, MSTATUS(*funcPtrClientCertCallback)(sbyte4 connInstance, SizedBuffer **ppRetCert, ubyte4 *pRetNumCerts, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLen, ubyte **ppRetCACert, ubyte4 *pRetNumCACerts))
 Set Callback to request cert and key from the Application. More...
 
MOC_EXTERN MSTATUS SSL_setClientRetrieveTicketCallback (sbyte4 connectionInstance, sbyte4(*cb)(sbyte4 connectionInstance, sbyte *serverInfo, ubyte4 serverInfoLen, void *userData, ubyte **ppTicket, ubyte4 *pTicketLen, intBoolean *pFreememory))
 
MOC_EXTERN MSTATUS SSL_setClientSavePSKCallback (sbyte4 connectionInstance, sbyte4(*cb)(sbyte4 connectionInstance, sbyte *ServerInfo, ubyte4 serverInfoLen, void *userData, ubyte *pPsk, ubyte4 pskLen))
 
MOC_EXTERN MSTATUS SSL_setClientSaveTicketCallback (sbyte4 connectionInstance, sbyte4(*cb)(sbyte4 connectionInstance, sbyte *serverInfo, ubyte4 serverInfoLen, void *userData, ubyte *pTicket, ubyte4 ticketLen))
 
MOC_EXTERN sbyte4 SSL_setClientSRPIdentity (sbyte4 connectionInstance, ubyte *userName, ubyte userNameLen, ubyte *password, ubyte4 passwordLen)
 
MOC_EXTERN sbyte4 SSL_setCookie (sbyte4 connectionInstance, void *cookie)
 Store custom information for a connection instance. More...
 
MOC_EXTERN sbyte4 SSL_setDHParameters (ubyte *pP, ubyte4 pLen, ubyte *pG, ubyte4 gLen, ubyte4 lengthY)
 Set the DH parameters to use during the SSL connection. More...
 
MOC_EXTERN sbyte4 SSL_setDNSNames (sbyte4 connectionInstance, const CNMatchInfo *cnMatchInfo)
 Specify a list of DNS names acceptable to the client. More...
 
MOC_EXTERN sbyte4 SSL_setDSACiphers (sbyte4 connectionInstance, ubyte enableDSACiphers)
 Enable/disable DSA ciphers. More...
 
MOC_EXTERN sbyte4 SSL_setEAPFASTParams (sbyte4 connectionInstance, ubyte *pPacOpaque, ubyte4 pacOpaqueLen, ubyte pPacKey[])
 
MOC_EXTERN sbyte4 SSL_setEarlyData (sbyte4 connectionInstance, ubyte *pEarlyData, ubyte4 earlyDataSize)
 Set the max early data. More...
 
MOC_EXTERN sbyte4 SSL_setFIPSEnabled (ubyte isFIPSEnabled)
 Enable FIPS at runtime. More...
 
MOC_EXTERN MSTATUS SSL_setFuncPtrAlertCallback (sbyte4(*funcPtrAlertCallback)(sbyte4 connectionInstance, sbyte4 alertId, sbyte4 alertClass))
 
MOC_EXTERN MSTATUS SSL_setFuncPtrChoosePSK (sbyte4(*funcPtrChoosePSK)(sbyte4, ubyte *, ubyte4, ubyte retPskIdentity[SSL_PSK_SERVER_IDENTITY_LENGTH], ubyte4 *, ubyte retPSK[SSL_PSK_MAX_LENGTH], ubyte4 *))
 
MOC_EXTERN MSTATUS SSL_setFuncPtrClientRehandshakeRequest (sbyte4(*funcPtrClientRehandshakeRequest)(sbyte4 connectionInstance))
 
MOC_EXTERN MSTATUS SSL_setFuncPtrGetHintPSK (sbyte4(*funcPtrGetHintPSK)(sbyte4, ubyte hintPSK[SSL_PSK_SERVER_IDENTITY_LENGTH], ubyte4 *))
 
MOC_EXTERN MSTATUS SSL_setFuncPtrKeyUpdateRequest (sbyte4(*funcPtrKeyUpdate)(sbyte4 connectionInstance))
 
MOC_EXTERN MSTATUS SSL_setFuncPtrLookupPSK (sbyte4(*funcPtrLookupPSK)(sbyte4, ubyte *, ubyte4, ubyte[SSL_PSK_MAX_LENGTH], ubyte4 *))
 
MOC_EXTERN MSTATUS SSL_setFuncPtrSRPCallback (sbyte4(*funcPtrSRPCallback)(sbyte4 connectionInstance, const ubyte *identity, ubyte4 identityLength, sbyte4 *numBits, ubyte salt[SSL_PSK_SERVER_IDENTITY_LENGTH], ubyte4 *saltLength, ubyte **verifier, ubyte4 *verifierLength))
 
MOC_EXTERN sbyte4 SSL_setInnerApplicationExt (sbyte4 connectionInstance, ubyte4 innerAppValue)
 
MOC_EXTERN MSTATUS SSL_setInvalidCertCallback (sbyte4 connectionInstance, MSTATUS(*funcPtrInvalidCertCallback)(sbyte4 connectionInstance, MSTATUS validationstatus))
 Provide status to application when stack receives empty certificate. More...
 
MOC_EXTERN MSTATUS SSL_setmaxByteCount (ubyte4 byteCount)
 
MOC_EXTERN sbyte4 SSL_setMaxEarlyDataSize (sbyte4 connectionInstance, sbyte4 earlyDataSize)
 Set the max early data size. More...
 
MOC_EXTERN sbyte4 SSL_setMaxProtoVersion (ubyte4 version)
 
MOC_EXTERN MSTATUS SSL_setMaxTimerCountForRehandshake (ubyte4 timerCount)
 
MOC_EXTERN sbyte4 SSL_setMinProtoVersion (ubyte4 version)
 
MOC_EXTERN sbyte4 SSL_setMinRSAKeySize (ubyte4 keySize)
 Set the minimum RSA Key Size. More...
 
MOC_EXTERN MSTATUS SSL_setMutualAuthCertificateAlias (sbyte4 connectionInstance, ubyte *pAlias, ubyte4 aliasLen)
 Set the alias of the certificate-key pair to be used for mutual auth. More...
 
MOC_EXTERN MSTATUS SSL_setOCSPCallback (sbyte4(*funcPtrSingleCertStatusCallback)(sbyte4 connectionInstance, const ubyte *pCert, ubyte4 certLen, ubyte *pOcspResp, ubyte4 oscpRespLen, sbyte4 ocspStatus))
 
MOC_EXTERN sbyte4 SSL_setOcspResponderUrl (sbyte4 connectionInstance, const char *pUrl)
 
MOC_EXTERN sbyte4 SSL_setReceiveApplicationDataCallback (sbyte4(*funcPtrTLS13ApplicationDataCallback)(sbyte4 connectionInstance, ubyte *pData, ubyte4 dataLen, dataState state))
 Function to set the callback to pass data to the application received during the SSL handshake. More...
 
MOC_EXTERN sbyte4 SSL_setRecvEarlyDataSize (sbyte4 connectionInstance, sbyte4 recvEarlyDataSize)
 Set the recv early data size. More...
 
MOC_EXTERN MSTATUS SSL_setServerDeletePSKCallback (sbyte4(*cb)(sbyte4 connectionInstance, sbyte *ServerInfo, ubyte4 serverInfoLen, ubyte *pIdentityPSK, ubyte4 identityLengthPSK, ubyte *pPsk))
 
MOC_EXTERN MSTATUS SSL_setServerLookupPSKCallback (sbyte4(*cb)(sbyte4 connectionInstance, ubyte *pIdentityPSK, ubyte4 identityLengthPSK, ubyte **ppPsk, ubyte4 *pPskLen, intBoolean *pFreeMemory))
 
MOC_EXTERN sbyte4 SSL_setServerNameIndication (sbyte4 connectionInstance, const char *serverName)
 
MOC_EXTERN MSTATUS SSL_setServerSavePSKCallback (sbyte4(*cb)(sbyte4 connectionInstance, ubyte *ServerInfo, ubyte4 serverInfoLen, ubyte *pIdentityPSK, ubyte4 identityLengthPSK, ubyte *pPsk, ubyte4 pskLen))
 
MOC_EXTERN sbyte4 SSL_setSessionFlags (sbyte4 connectionInstance, ubyte4 flagsSSL)
 Store a connection's context (its flags). More...
 
MOC_EXTERN sbyte4 SSL_setSha1SigAlg (intBoolean setting)
 Dynamically set support for SHA-1 signature algorithms,. More...
 
MOC_EXTERN sbyte4 SSL_setSrtpEncodeCallback (sbyte4(*cb)(sbyte4 connectionInstance, peerDescr *pChannelDescr, const sbyte *pData, ubyte4 pDataLength, ubyte **encodedData, ubyte4 *encodedLength))
 
MOC_EXTERN sbyte4 SSL_setSrtpInitCallback (sbyte4(*cb)(sbyte4 connectionInstance, peerDescr *pChannelDescr, const SrtpProfileInfo *pProfile, void *keyMaterials, ubyte *mki))
 
MOC_EXTERN sbyte4 SSL_Settings_Ioctl (ubyte4 setting, void *value)
 Enable dynamic management of a connection's features. More...
 
MOC_EXTERN MSTATUS SSL_setVersionCallback (sbyte4 connectionInstance, MSTATUS(*funcPtrVersionCallback)(ubyte4 serverVersion, ubyte4 clientVersion, MSTATUS sslStatus))
 Register a version callback to record the server version and client version. More...
 
MOC_EXTERN sbyte4 SSL_shutdownStack (void)
 Clean up memory and mutexes and shut down the SSL stack. More...
 
MOC_EXTERN MSTATUS SSL_SOCK_getPeerCertificateBytes (sbyte4 connectionInstance, ubyte **ppCertBytes, ubyte4 *pCertLen)
 Retrieve size and length of the peer's certificate. More...
 
MOC_EXTERN sslSettingsSSL_sslSettings (void)
 Get a pointer to current context's configuration settings. More...
 
MOC_EXTERN MSTATUS SSL_TAP_clearKeyAndToken ()
 Unload the TAP keys in deferred mode, when the application is shutting down. More...
 
MOC_EXTERN sbyte4 SSL_UninitAsymmetricKey (AsymmetricKey *pAsymKey)
 
MOC_EXTERN sbyte4 SSL_updateInnerAppSecret (sbyte4 connectionInstance, ubyte *session_key, ubyte4 sessionKeyLen)
 
MOC_EXTERN sbyte4 SSL_verifyInnerAppVerifyData (sbyte4 connectionInstance, ubyte *data, InnerAppType appType)
 

Detailed Description

This header file contains definitions, enumerations, and function declarations used by NanoSSL and NanoDTLS servers and clients.

Since
1.41
Version
4.2 and later

(post-6.4 revision to SSL_setOcspResponderUrl() signature, commit [35a726e], March 30, 2016. Added SSL_setApplicationLayerProtocol() and SSL_getSelectedApplicationProtocol(), commit [e6173b4], March 21, 2016). Added TLS13_MINORVERSION #define, commit [61e569b], April 8.

Whether the following flags are defined determines which function declarations and callbacks are enabled:

  • __ENABLE_MOCANA_EAP_FAST__
  • __ENABLE_MOCANA_EXTRACT_CERT_BLOB__
  • __ENABLE_MOCANA_INNER_APP__
  • __ENABLE_MOCANA_MULTIPLE_COMMON_NAMES__
  • __ENABLE_MOCANA_SSL_ALERTS__
  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
  • __ENABLE_MOCANA_SSL_CLIENT__
  • __ENABLE_MOCANA_SSL_DUAL_MODE_API__
  • __ENABLE_MOCANA_SSL_ECDH_ANON_SUPPORT__
  • __ENABLE_MOCANA_SSL_ECDH_SUPPORT__
  • __ENABLE_MOCANA_SSL_ECDHE_SUPPORT__
  • __ENABLE_MOCANA_SSL_INTERNAL_STRUCT_ACCESS__
  • __ENABLE_MOCANA_SSL_KEY_EXPANSION__
  • __ENABLE_MOCANA_SSL_MUTUAL_AUTH_SUPPORT__
  • __ENABLE_MOCANA_SSL_NEW_HANDSHAKE__
  • __ENABLE_MOCANA_SSL_PSK_SUPPORT__
  • __ENABLE_MOCANA_SSL_SERVER__
  • __ENABLE_MOCANA_SSL_CUSTOM_RNG__

ssl.h

Function Documentation

◆ CERT_STORE_createStoreAlt()

MOC_EXTERN sbyte4 CERT_STORE_createStoreAlt ( void **  ppNewStore)

This function is used by the NanoSSL Shim layer to create and initialize a Digicert SoT Platform certificate store container instance. (Multiple instances are allowed.)

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__

cert_store.h

Parameters
ppNewStorePointer to certStorePtr, which on return, contains the newly allocated and initialized certificate store container.
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.

cert_store.c

◆ CERT_STORE_releaseStoreAlt()

MOC_EXTERN MSTATUS CERT_STORE_releaseStoreAlt ( void **  ppReleaseStore)

This function is used by NanoSSL Shim layer to release (free) memory used by a Digicert SoT Platform certificate store, including all its component structures.

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__

cert_store.h

Parameters
ppReleaseStorePointer to Digicert SoT Platform certificate store to release (free).
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.

cert_store.c

◆ SSL_getLocalState()

MOC_EXTERN sbyte4 SSL_getLocalState ( sbyte4  connectionInstance,
sbyte4 *  pState 
)

This function returns the last message sent by the stack.

Parameters
connectionInstancePointer to the SSL/TLS instance.
pStateOn return, pointer to the local state, one of the following values SSL_BEGIN (-1) SSL_HELLO_RETRY_REQUEST (6) SSL_FINISHED (20)
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.

◆ SSL_getState()

MOC_EXTERN sbyte4 SSL_getState ( sbyte4  connectionInstance,
sbyte4 *  pState 
)

This function returns the last handshake message/expected handshake message received by the stack.

Parameters
connectionInstancePointer to the SSL/TLS instance.
pStateOn return, pointer to the state, one of the following values SSL_BEGIN (-1) SSL_HELLO_REQUEST (0) SSL_CLIENT_HELLO (1) SSL_SERVER_HELLO (2) SSL_SERVER_HELLO_VERIFY_REQUEST (3) SSL_NEW_SESSION_TICKET (4) SSL_CLIENT_END_OF_EARLY_DATA (5) SSL_HELLO_RETRY_REQUEST (6) SSL_ENCRYPTED_EXTENSIONS (8) SSL_CERTIFICATE (11) SSL_SERVER_KEY_EXCHANGE (12) SSL_CERTIFICATE_REQUEST (13) SSL_SERVER_HELLO_DONE (14) SSL_CLIENT_CERTIFICATE_VERIFY (15) SSL_CLIENT_KEY_EXCHANGE (16) SSL_EXPECTING_FINISHED (19) SSL_FINISHED (20) SSL_CERTIFICATE_STATUS (22) SSL_KEY_UPDATE (24) SSL_MESSAGE_HASH (254)
Returns
0 or a positive number if successful; 1 means connection is already established. 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.

◆ SSL_isRehandshakeAllowed()

MOC_EXTERN sbyte4 SSL_isRehandshakeAllowed ( sbyte4  connectionInstance,
intBoolean *  pRehandshake 
)

Check if the rehandshake is allowed for the connection.

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

  • __ENABLE_MOCANA_SSL_REHANDSHAKE__

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

  • __ENABLE_MOCANA_SSL_CLIENT__
  • __ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
  • __ENABLE_MOCANA_SSL_SERVER__
  • __ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
Parameters
connectionInstanceConnection instance returned from SSL_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.

◆ SSL_setCertVerifySignCallback()

MOC_EXTERN MSTATUS SSL_setCertVerifySignCallback ( sbyte4(*)(sbyte4 connectionInstance, const ubyte *pHash, ubyte4 hashLen, ubyte *pResult, ubyte4 resultLength)  funcPtrMutualAuthCertificateVerify)

This API sets the application defined callback function which is used by an ssl client when it needs to compute the content of a certificate verify message for mutual authentication.

Parameters
cbApplication defined funcPtrMutualAuthCertificateVerify Callback
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English test error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

◆ SSL_setMutualAuthCertificateAlias()

MOC_EXTERN MSTATUS SSL_setMutualAuthCertificateAlias ( sbyte4  connectionInstance,
ubyte *  pAlias,
ubyte4  aliasLen 
)

This function lets you set the alias and alias length; This alias will be used to lookup the certificate-key pair when responding to CertificateRequest message from the server. This API should be called prior to SSL_negotiateConnection() and after SSL_connect()

Since
Version

To enable define the following fla in moptions.h +__ENABLE_MOCANA_SSL_CLIENT__ +__ENABLE_MOCANA_SSL_MUTUAL_AUTH_SUPPORT__

Parameters
pAliasAlias byte string; Alias will be used to search the corresponding certificate
aliasLenLength of the alias byte string
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English test error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This callback function is applicable to synchronous and asynchronous clients and servers.

ssl.h

◆ SSL_setReceiveApplicationDataCallback()

MOC_EXTERN sbyte4 SSL_setReceiveApplicationDataCallback ( sbyte4(*)(sbyte4 connectionInstance, ubyte *pData, ubyte4 dataLen, dataState state)  funcPtrTLS13ApplicationDataCallback)

This function sets the callback function, which is invoked by the stack when it receives Application Data during the handshake is in progress. TLS 1.3 provides such a provision.

Since
Version

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

  • __ENABLE_MOCANA_TLS13__
  • __ENABLE_MOCANA_TLS13_0RTT__

ssl.h

Parameters
connectionInstanceConnection instance returned from SSL_connect()/SSL_acceptConnection().
funcPtrTLS13ApplicationDataCallbackFunction pointer to a valid function, which handles the 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.

ssl.c

◆ SSL_SOCK_getPeerCertificateBytes()

MOC_EXTERN MSTATUS SSL_SOCK_getPeerCertificateBytes ( sbyte4  connectionInstance,
ubyte **  ppCertBytes,
ubyte4 *  pCertLen 
)

This function retrieves the peer's certificate and provides the certificate's data size in terms of bytes and the length of the certificate.

Since
6.5
Version
6.5 and later

To enable this function, no flags need to be defined in moptions.h

cert_chain.h

Parameters
connectionInstanceConnection instance returned from SSL_connect().
ppCertBytesOn return, pointer to number of bytes in the certificate.
pCertLenOn return, pointer to the length of the certificate.
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.

cert_store.c

◆ SSL_TAP_clearKeyAndToken()

MOC_EXTERN MSTATUS SSL_TAP_clearKeyAndToken ( )

This function unloads the TAP keys in deferred mode.

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

  • __ENABLE_MOCANA_TAP__
  • __ENABLE_MOCANA_TAP_DEFER_UNLOADKEY__

ssl.h

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.