mirror of https://github.com/moparisthebest/curl
removed trailing whitespace, indented to curl-style levels
This commit is contained in:
parent
498a0fe795
commit
cb88135220
|
@ -1,8 +1,8 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* _ _ ____ _
|
* _ _ ____ _
|
||||||
* Project ___| | | | _ \| |
|
* Project ___| | | | _ \| |
|
||||||
* / __| | | | |_) | |
|
* / __| | | | |_) | |
|
||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
|
@ -71,42 +71,48 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
while(1) /* do some ugly short cut... */
|
while(1) /* do some ugly short cut... */
|
||||||
{
|
{
|
||||||
if (pEngine) /* use crypto engine */
|
if (pEngine) /* use crypto engine */
|
||||||
{
|
{
|
||||||
if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK)
|
if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK)
|
||||||
{ /* load the crypto engine */
|
{ /* load the crypto engine */
|
||||||
fprintf(stderr,"can't set crypto engine\n");
|
fprintf(stderr,"can't set crypto engine\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK)
|
if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK)
|
||||||
{ /* set the crypto engine as default */
|
{ /* set the crypto engine as default */
|
||||||
/* only needed for the first time you load
|
/* only needed for the first time you load
|
||||||
a engine in a curl object... */
|
a engine in a curl object... */
|
||||||
fprintf(stderr,"can't set crypto engine as default\n");
|
fprintf(stderr,"can't set crypto engine as default\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* cert is stored PEM coded in file... */
|
/* cert is stored PEM coded in file... */
|
||||||
/* since PEM is default, we needn't set it for PEM */
|
/* since PEM is default, we needn't set it for PEM */
|
||||||
curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
|
curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
|
||||||
/* set the cert for client authentication */
|
|
||||||
curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile);
|
/* set the cert for client authentication */
|
||||||
/* sorry, for engine we must set the passphrase
|
curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile);
|
||||||
(if the key has one...) */
|
|
||||||
if (pPassphrase)
|
/* sorry, for engine we must set the passphrase
|
||||||
curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase);
|
(if the key has one...) */
|
||||||
/* if we use a key stored in a crypto engine,
|
if (pPassphrase)
|
||||||
we must set the key type to "ENG" */
|
curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase);
|
||||||
curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType);
|
|
||||||
/* set the private key (file or ID in engine) */
|
/* if we use a key stored in a crypto engine,
|
||||||
curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName);
|
we must set the key type to "ENG" */
|
||||||
/* set the file with the certs vaildating the server */
|
curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType);
|
||||||
curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile);
|
|
||||||
/* disconnect if we can't validate server's cert */
|
/* set the private key (file or ID in engine) */
|
||||||
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1);
|
curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName);
|
||||||
|
|
||||||
res = curl_easy_perform(curl);
|
/* set the file with the certs vaildating the server */
|
||||||
break; /* we are done... */
|
curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile);
|
||||||
|
|
||||||
|
/* disconnect if we can't validate server's cert */
|
||||||
|
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1);
|
||||||
|
|
||||||
|
res = curl_easy_perform(curl);
|
||||||
|
break; /* we are done... */
|
||||||
}
|
}
|
||||||
/* always cleanup */
|
/* always cleanup */
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
|
Loading…
Reference in New Issue