Encryption Hook

The rpcEncryptMessage user-supplied Encryption hook function is called when RPC encryption is enabled on a node. The rpcEncryptMessage function has the following format.

int JOMAPI rpcEncryptMessage(const void *inData,
                             unsigned   inLength,
                             void       **outData,
                             unsigned   *pOutLength,
                             int        *pUserData);

The RPC encryption hook is called by the Jade client-side RPC for request messages and the server-side RPC for response messages before the message is handed to the network transport layer for transmission.

Before calling the user encryption routine, a CRC is generated and inserted into the RPC header. A flag is also set in the header, indicating that the message is encrypted. The optional pUserData parameter value is also sent in the header and passed to the decryption routine on the other side. You can use the pUserData parameter to identify the version or type of algorithm being used.

The rpcEncryptMessage function returns the following values.

Value Description
0 The encryption routine was successful
Non-zero The encryption routine failed