1=pod
2
3=head1 NAME
4
5ossl-guide-libssl-introduction, ssl
6- OpenSSL Guide: An introduction to libssl
7
8=head1 INTRODUCTION
9
10The OpenSSL C<libssl> library provides implementations of several secure network
11communications protocols. Specifically it provides SSL/TLS (SSLv3, TLSv1,
12TLSv1.1, TLSv1.2 and TLSv1.3), DTLS (DTLSv1 and DTLSv1.2) and QUIC (client side
13only). The library depends on C<libcrypto> for its underlying cryptographic
14operations (see L<ossl-guide-libcrypto-introduction(7)>).
15
16The set of APIs supplied by C<libssl> is common across all of these different
17network protocols, so a developer familiar with writing applications using one
18of these protocols should be able to transition to using another with relative
19ease.
20
21An application written to use C<libssl> will include the F<< <openssl/ssl.h> >>
22header file and will typically use two main data structures, i.e. B<SSL> and
23B<SSL_CTX>.
24
25An B<SSL> object is used to represent a connection to a remote peer. Once a
26connection with a remote peer has been established data can be exchanged with
27that peer.
28
29When using DTLS any data that is exchanged uses "datagram" semantics, i.e.
30the packets of data can be delivered in any order, and they are not guaranteed
31to arrive at all. In this case the B<SSL> object used for the connection is also
32used for exchanging data with the peer.
33
34Both TLS and QUIC support the concept of a "stream" of data. Data sent via a
35stream is guaranteed to be delivered in order without any data loss. A stream
36can be uni- or bi-directional.
37
38SSL/TLS only supports one stream of data per connection and it is always
39bi-directional. In this case the B<SSL> object used for the connection also
40represents that stream. See L<ossl-guide-tls-introduction(7)> for more
41information.
42
43The QUIC protocol can support multiple streams per connection and they can be
44uni- or bi-directional. In this case an B<SSL> object can represent the
45underlying connection, or a stream, or both. Where multiple streams are in use
46a separate B<SSL> object is used for each one. See
47L<ossl-guide-quic-introduction(7)> for more information.
48
49An B<SSL_CTX> object is used to create the B<SSL> object for the underlying
50connection. A single B<SSL_CTX> object can be used to create many connections
51(each represented by a separate B<SSL> object). Many API functions in libssl
52exist in two forms: one that takes an B<SSL_CTX> and one that takes an B<SSL>.
53Typically settings that you apply to the B<SSL_CTX> will then be inherited by
54any B<SSL> object that you create from it. Alternatively you can apply settings
55directly to the B<SSL> object without affecting other B<SSL> objects. Note that
56you should not normally make changes to an B<SSL_CTX> after the first B<SSL>
57object has been created from it.
58
59=head1 DATA STRUCTURES
60
61As well as B<SSL_CTX> and B<SSL> there are a number of other data structures
62that an application may need to use. They are summarised below.
63
64=over 4
65
66=item B<SSL_METHOD> (SSL Method)
67
68This structure is used to indicate the kind of connection you want to make, e.g.
69whether it is to represent the client or the server, and whether it is to use
70SSL/TLS, DTLS or QUIC (client only). It is passed as a parameter when creating
71the B<SSL_CTX>.
72
73=item B<SSL_SESSION> (SSL Session)
74
75After establishing a connection with a peer the agreed cryptographic material
76can be reused to create future connections with the same peer more rapidly. The
77set of data used for such a future connection establishment attempt is collected
78together into an B<SSL_SESSION> object. A single successful connection with a
79peer may generate zero or more such B<SSL_SESSION> objects for use in future
80connection attempts.
81
82=item B<SSL_CIPHER> (SSL Cipher)
83
84During connection establishment the client and server agree upon cryptographic
85algorithms they are going to use for encryption and other uses. A single set
86of cryptographic algorithms that are to be used together is known as a
87ciphersuite. Such a set is represented by an B<SSL_CIPHER> object.
88
89The set of available ciphersuites that can be used are configured in the
90B<SSL_CTX> or B<SSL>.
91
92=back
93
94=head1 FURTHER READING
95
96See L<ossl-guide-tls-introduction(7)> for an introduction to the SSL/TLS
97protocol and L<ossl-guide-quic-introduction(7)> for an introduction to QUIC.
98
99See L<ossl-guide-libcrypto-introduction(7)> for an introduction to C<libcrypto>.
100
101=head1 SEE ALSO
102
103L<ossl-guide-libcrypto-introduction(7)>, L<ossl-guide-tls-introduction(7)>,
104L<ossl-guide-quic-introduction(7)>
105
106=head1 COPYRIGHT
107
108Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.
109
110Licensed under the Apache License 2.0 (the "License").  You may not use
111this file except in compliance with the License.  You can obtain a copy
112in the file LICENSE in the source distribution or at
113L<https://www.openssl.org/source/license.html>.
114
115=cut
116