HTTPS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

HTTPS

milan tomic-3
HTTPS

Where can I find some HTTPS client app example using OpenSSL? I have found cli.cpp in the OpenSSL distribution but it connects to the server through sockets.

Reply | Threaded
Open this post in threaded view
|

Re: HTTPS

Bernhard Fröhlich-2
Milan Tomic wrote:

>
> Where can I find some HTTPS client app example using OpenSSL? I have
> found cli.cpp in the OpenSSL distribution but it connects to the
> server through sockets.
>
I guess cli.cpp is exactly what you are looking for. You first have to
set up the connection using sockets and then the SSL-Handshake is
initiated by a call to SSL_connect(). At least that's what my modules do
if they have to do HTTPS... ;)

Hope it helps
Ted
;)

--
PGP Public Key Information
Download complete Key from http://www.convey.de/ted/tedkey_convey.asc
Key fingerprint = 31B0 E029 BCF9 6605 DAC1  B2E1 0CC8 70F4 7AFB 8D26


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: HTTPS

milan tomic-3

Can "cli.cpp" run on Windows platform? I need Windows OpenSSL HTTPS
client.

While compiling I got an error saying that it can't find "sys/socket.h"
include file.

Thank you.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: HTTPS

Bernhard Fröhlich-2
Milan Tomic wrote:

>Can "cli.cpp" run on Windows platform? I need Windows OpenSSL HTTPS
>client.
>
>While compiling I got an error saying that it can't find "sys/socket.h"
>include file.
>
>Thank you.
>  
>
Uhh, hard times ahead if you want to code SSL and ask me such
questions... ;)

I guess you'll need the following headers:

#include "windows.h"
#include "winsock.h"
#include "stdio.h"
#include "stdlib.h"

plus the openssl-headers :

#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>

to compile cli.cpp. Maybe perror still gives you trouble, just replace
it with printf. If it does not find any of the headers try to kick out
the include-statement and if you get compile errors check your
compiler's documentation for the file to include for the missing functions.

Hope it helps
Ted
;)

--
PGP Public Key Information
Download complete Key from http://www.convey.de/ted/tedkey_convey.asc
Key fingerprint = 31B0 E029 BCF9 6605 DAC1  B2E1 0CC8 70F4 7AFB 8D26


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: HTTPS

Olaf Gellert
In reply to this post by milan tomic-3
Milan Tomic wrote:
>
> Where can I find some HTTPS client app example using OpenSSL? I have
> found cli.cpp in the OpenSSL distribution but it connects to the server
> through sockets.

If you are looking for a binary that does the job you
may simply use "openssl s_client"...

Olaf

--
Dipl.Inform. Olaf Gellert                  PRESECURE (R)
Senior Researcher,                       Consulting GmbH
Phone: (+49) 0700 / PRESECURE           [hidden email]

                        A daily view on Internet Attacks
                        https://www.ecsirt.net/sensornet

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: HTTPS

padma saxena
In reply to this post by milan tomic-3
Have you looked at libwww from W3C?

--- Milan Tomic <[hidden email]> wrote:

>
> Where can I find some HTTPS client app example using
> OpenSSL? I have
> found cli.cpp in the OpenSSL distribution but it
> connects to the server
> through sockets.
>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: HTTPS

milan tomic-3
In reply to this post by Bernhard Fröhlich-2

Thank you Ted. It compiles now. :>

How can I set client certificate for SSL connection? I keep cert in
sslclient.pfx file.

Best regards,
Milan


> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Bernhard Froehlich
> Sent: Friday, July 15, 2005 1:29 PM
> To: [hidden email]
> Subject: Re: HTTPS
>
>
> Milan Tomic wrote:
>
> >Can "cli.cpp" run on Windows platform? I need Windows OpenSSL HTTPS
> >client.
> >
> >While compiling I got an error saying that it can't find
> "sys/socket.h"
> >include file.
> >
> >Thank you.
> >  
> >
> Uhh, hard times ahead if you want to code SSL and ask me such
> questions... ;)
>
> I guess you'll need the following headers:
>
> #include "windows.h"
> #include "winsock.h"
> #include "stdio.h"
> #include "stdlib.h"
>
> plus the openssl-headers :
>
> #include <openssl/crypto.h>
> #include <openssl/x509.h>
> #include <openssl/pem.h>
> #include <openssl/ssl.h>
> #include <openssl/err.h>
>
> to compile cli.cpp. Maybe perror still gives you trouble,
> just replace
> it with printf. If it does not find any of the headers try to
> kick out
> the include-statement and if you get compile errors check your
> compiler's documentation for the file to include for the
> missing functions.
>
> Hope it helps
> Ted
> ;)
>
> --
> PGP Public Key Information
> Download complete Key from http://www.convey.de/ted/tedkey_convey.asc
> Key fingerprint = 31B0 E029 BCF9 6605 DAC1  B2E1 0CC8 70F4 7AFB 8D26
>
>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: HTTPS

Bernhard Fröhlich-2
Milan Tomic wrote:

>Thank you Ted. It compiles now. :>
>
>How can I set client certificate for SSL connection? I keep cert in
>sslclient.pfx file.
>
>Best regards,
>Milan
>  
>
You should have a look at the sample code for the SSL book, which is
downloadable on http://www.opensslbook.com/code.html
The client*.c files show how the SSL connection is handled with
different levels of secutiry (no encryption, check server only, use
client cert). And I can recommend the book itself, which is an excellent
place to look up such information. ;)

The relevant functions are also documented in
http://www.openssl.org/docs/ssl/SSL_CTX_use_certificate.html
I don't know the format of *.pfx files. You could just try to load it
with SSL_CTX_use_certificate_chain_file with different type-constants.
Then you'll have to tell OpenSSL which private key to use (which is
probably also hidden somewhere in the *.pfx-File) with
SSL_CTX_use_PrivateKey or similar functions.

Hope it helps,
Ted
;)

--
PGP Public Key Information
Download complete Key from http://www.convey.de/ted/tedkey_convey.asc
Key fingerprint = 31B0 E029 BCF9 6605 DAC1  B2E1 0CC8 70F4 7AFB 8D26


smime.p7s (4K) Download Attachment