From cb8813522083672d408325a11300b91dffd806c3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 12 Aug 2004 07:01:20 +0000 Subject: removed trailing whitespace, indented to curl-style levels --- docs/examples/simplessl.c | 86 +++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 40 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 781e06909..745d6e82c 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -1,8 +1,8 @@ /***************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * $Id$ @@ -71,42 +71,48 @@ int main(int argc, char **argv) while(1) /* do some ugly short cut... */ { - if (pEngine) /* use crypto engine */ - { - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) - { /* load the crypto engine */ - fprintf(stderr,"can't set crypto engine\n"); - break; - } - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK) - { /* set the crypto engine as default */ - /* only needed for the first time you load - a engine in a curl object... */ - fprintf(stderr,"can't set crypto engine as default\n"); - break; - } - } - /* cert is stored PEM coded in file... */ - /* since PEM is default, we needn't set it for PEM */ - curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); - /* set the cert for client authentication */ - curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); - /* sorry, for engine we must set the passphrase - (if the key has one...) */ - if (pPassphrase) - curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase); - /* if we use a key stored in a crypto engine, - we must set the key type to "ENG" */ - curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); - /* set the private key (file or ID in engine) */ - curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); - /* set the file with the certs vaildating the server */ - 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... */ + if (pEngine) /* use crypto engine */ + { + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) + { /* load the crypto engine */ + fprintf(stderr,"can't set crypto engine\n"); + break; + } + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK) + { /* set the crypto engine as default */ + /* only needed for the first time you load + a engine in a curl object... */ + fprintf(stderr,"can't set crypto engine as default\n"); + break; + } + } + /* cert is stored PEM coded in file... */ + /* since PEM is default, we needn't set it for PEM */ + curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); + + /* set the cert for client authentication */ + curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); + + /* sorry, for engine we must set the passphrase + (if the key has one...) */ + if (pPassphrase) + curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase); + + /* if we use a key stored in a crypto engine, + we must set the key type to "ENG" */ + curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); + + /* set the private key (file or ID in engine) */ + curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); + + /* set the file with the certs vaildating the server */ + 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 */ curl_easy_cleanup(curl); -- cgit v1.2.3