ThingWorx Edge C SDK > Using SSL/TLS for Security > Proxy Server Authentication
  
Proxy Server Authentication
The C SDK supports the following authentication options for communicating with ThingWorx platform through a proxy server:
No authentication
Basic authentication
Digest authentication
NTLM
As of v.2.2.0, the C SDK uses a callback function to retrieve a basic password or a digest when it needs to authenticate with a proxy server. The twPasswords.h file provides the signatures for this callback function:

typedef void (*twPasswdCallbackFunction)(char * passwdBuffer, unsigned int maxPasswdSize);
where passwdBuffer allocates a buffer in which to copy the password or digest and maxPasswdSize is the size of the buffer. Do not copy a password or digest that is longer than maxPasswdSize into passwdBuffer.
* 
In production, this callback should obtain a password or digest from a secure source.
Use the following function to set up communication through a proxy server:
int twApi_SetProxyInfo(char * proxyHost, uint16_t proxyPort, char * proxyUser, char * passwdCallback);
The following table lists and briefly describes the parameters you can specify:
Parameter
Description
proxyHost
The IP address or host name of the proxy server to use when connecting to the ThingWorx platform.
proxyPort
The number of the port on the proxy server to use.
proxyUser
If the proxy server requires Basic or Digest authentication, provide a user nameto present to the proxy server on connection. These credentials are only for the proxy server. They are not passed beyond the proxy server.
passwdCallback
For a password, you must use the twPasswordCallbackFunction to obtain an encrypted password from a source of your choosing and store the encrypted password in passwdCallback. For example, your application might request the credentials in a user interface or command line interface.
The C SDK retrieves and uses the password when it must access the proxy server. It then zeroes out the passwdCallback and discards it from memory. See also Passwords (C SDK 2.2.0 and later).
Tunneling with Proxy Servers
When using a proxy server, you must set both the initial proxy as shown above using twApi_SetProxyInfo AND the proxy for tunneling with twTunnelManager_SetProxyInfo. If you set only the initial proxy and not the tunneling proxy, the connection succeeds but the tunneling fails. See Tunneling with Proxy Servers for more information about setting up the proxy server for tunneling.