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