cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modify the FlexNet Embedded SDK examples to use HTTPS

Modify the FlexNet Embedded SDK examples to use HTTPS

Summary

The FlexNet Embedded SDK examples that send and receive messages over the network?such as the capability-request and metered examples?are configured to communicate with a server over HTTP. In some cases, such as communications with FlexNet Operations On-Demand, it is necessary or desirable to communicate over HTTPS. This article describes how to modify the example code to use HTTPS instead of HTTP.

Synopsis

The FlexNet Embedded SDK examples that send and receive messages over the network?such as the capability-request and metered examples?are configured to communicate with a server over HTTP. In some cases, such as communications with FlexNet Operations On-Demand, it is necessary or desirable to communicate over HTTPS. This article describes how to modify the example code to use HTTPS instead of HTTP.

Windows Platforms

To modify the capability-request example to use HTTPS, open the capability request project in build\capabilityrequest directory, open the source file CapabilityRequest.c, and locate the definition of the TalkToServer helper function.

In the definition of TalkToServer, locate the call to HttpOpenRequest, and add the flag INTERNET_FLAG_SECURE to the next-to-last argument. The call to HttpOpenRequest will then appear as follows:

hRequest = HttpOpenRequest(hConnect,

_T("POST"), /* verb */

serverDirectory, /* object name */

NULL, /* default version */

NULL, /* no referer */

NULL, /* access type, use default */

INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_SECURE,

0);

After building the example, you can run it using a command such as the following, where the port value 443 is the standard HTTPS port number.

capabilityrequest -server exampleuat.subscribenet.com 443 control/example/DeviceActivationService

Linux and other non-Windows Platforms

To modify the capability-request example to use HTTPS on non-Windows platforms, open the source file examples/client_samples/capability_request/CapabilityRequest.c and locate the definition of the TalkToServer helper function.

In the definition of TalkToServer, locate the series of calls to curl_easy_setopt and add the following, where the final argument is the location of the existing certificate store:

curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/ssl/certs");

As an alternative, you can use the CURLOPT_CAINFO flag and specify the path to a file (such as a PEM file) that contains a root certificate:

curl_easy_setopt(curl, CURLOPT_CAINFO, "path to file containing root certificate");

After building the example, you can run it using a command similar to the following, where the port value 443 is the standard HTTPS port number.

caprequest -server exampleuat.subscribenet.com 443 control/example/DeviceActivationService

Labels (1)
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Apr 04, 2013 03:53 AM
Updated by: