Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
cb881352
Commit
cb881352
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
removed trailing whitespace, indented to curl-style levels
parent
498a0fe7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/examples/simplessl.c
+46
-40
46 additions, 40 deletions
docs/examples/simplessl.c
with
46 additions
and
40 deletions
docs/examples/simplessl.c
+
46
−
40
View file @
cb881352
/*****************************************************************************
* _ _ ____ _
* 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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment