Fix unused variable warning of GCC
[openssl.git] / doc / ssl_ctx.doc
1 This is now a bit dated, quite a few of the SSL_ functions could be
2 SSL_CTX_ functions.  I will update this in the future. 30 Aug 1996
3
4 From eay@orb.mincom.oz.au Mon Dec 11 21:37:08 1995
5 Received: by orb.mincom.oz.au id AA00696
6   (5.65c/IDA-1.4.4 for eay); Mon, 11 Dec 1995 11:37:08 +1000
7 Date: Mon, 11 Dec 1995 11:37:08 +1000 (EST)
8 From: Eric Young <eay@mincom.oz.au>
9 X-Sender: eay@orb
10 To: sameer <sameer@c2.org>
11 Cc: Eric Young <eay@mincom.oz.au>
12 Subject: Re: PEM_readX509 oesn't seem to be working
13 In-Reply-To: <199512110102.RAA12521@infinity.c2.org>
14 Message-Id: <Pine.SOL.3.91.951211112115.28608D-100000@orb>
15 Mime-Version: 1.0
16 Content-Type: TEXT/PLAIN; charset=US-ASCII
17 Status: RO
18 X-Status: 
19
20 On Sun, 10 Dec 1995, sameer wrote:
21 >       OK, that's solved. I've found out that it is saying "no
22 > certificate set" in SSL_accept because s->conn == NULL
23 > so there is some place I need to initialize s->conn that I am
24 > not initializing it.
25
26 The full order of things for a server should be.
27
28 ctx=SSL_CTX_new();
29
30 /* The next line should not really be using ctx->cert but I'll leave it 
31  * this way right now... I don't want a X509_ routine to know about an SSL
32  * structure, there should be an SSL_load_verify_locations... hmm, I may 
33  * add it tonight.
34  */
35 X509_load_verify_locations(ctx->cert,CAfile,CApath);
36
37 /* Ok now for each new connection we do the following */
38 con=SSL_new(ctx);
39 SSL_set_fd(con,s);
40 SSL_set_verify(con,verify,verify_callback);
41
42 /* set the certificate and private key to use. */
43 SSL_use_certificate_ASN1(con,X509_certificate);
44 SSL_use_RSAPrivateKey_ASN1(con,RSA_private_key);
45
46 SSL_accept(con);
47
48 SSL_read(con)/SSL_write(con);
49
50 There is a bit more than that but that is basically the structure.
51
52 Create a context and specify where to lookup certificates.
53
54 foreach connection
55         {
56         create a SSL structure
57         set the certificate and private key
58         do a SSL_accept
59         
60         we should now be ok
61         }
62
63 eric
64 --
65 Eric Young                  | Signature removed since it was generating
66 AARNet: eay@mincom.oz.au    | more followups than the message contents :-)
67
68