Blame doc/cha-library.texi

Packit aea12f
@node Introduction to GnuTLS
Packit aea12f
@chapter Introduction to GnuTLS
Packit aea12f
Packit aea12f
In brief @acronym{GnuTLS} can be described as a library which offers an API
Packit aea12f
to access secure communication protocols. These protocols provide
Packit aea12f
privacy over insecure lines, and were designed to prevent
Packit aea12f
eavesdropping, tampering, or message forgery.
Packit aea12f
Packit aea12f
Technically @acronym{GnuTLS} is a portable ANSI C based library which
Packit aea12f
implements the protocols ranging from SSL 3.0 to TLS 1.3 (see @ref{Introduction to TLS}, 
Packit aea12f
for a detailed description of the protocols), accompanied
Packit aea12f
with the required framework for authentication and public key
Packit aea12f
infrastructure.  Important features of the @acronym{GnuTLS} library
Packit aea12f
include:
Packit aea12f
Packit aea12f
@itemize
Packit aea12f
Packit aea12f
@item Support for TLS 1.3, TLS 1.2, TLS 1.1, TLS 1.0 and optionally SSL 3.0 protocols.
Packit aea12f
Packit aea12f
@item Support for Datagram TLS 1.0 and 1.2.
Packit aea12f
Packit aea12f
@item Support for handling and verification of @acronym{X.509} certificates.
Packit aea12f
Packit aea12f
@item Support for password authentication using @acronym{TLS-SRP}.
Packit aea12f
Packit aea12f
@item Support for keyed authentication using @acronym{TLS-PSK}.
Packit aea12f
Packit aea12f
@item Support for TPM, @acronym{PKCS} #11 tokens and smart-cards.
Packit aea12f
Packit aea12f
@end itemize
Packit aea12f
Packit aea12f
The @acronym{GnuTLS} library consists of three independent parts, namely the ``TLS
Packit aea12f
protocol part'', the ``Certificate part'', and the ``Cryptographic
Packit aea12f
back-end'' part.  The ``TLS protocol part'' is the actual protocol
Packit aea12f
implementation, and is entirely implemented within the
Packit aea12f
@acronym{GnuTLS} library.  The ``Certificate part'' consists of the
Packit aea12f
certificate parsing, and verification functions and it uses
Packit aea12f
functionality from the
Packit aea12f
libtasn1 library.
Packit aea12f
The ``Cryptographic back-end'' is provided by the nettle
Packit aea12f
and gmplib libraries.
Packit aea12f
Packit aea12f
@menu
Packit aea12f
* Downloading and installing::
Packit aea12f
* Installing for a software distribution::
Packit aea12f
* Document overview::
Packit aea12f
@end menu
Packit aea12f
Packit aea12f
@node Downloading and installing
Packit aea12f
@section Downloading and installing
Packit aea12f
@cindex installation
Packit aea12f
@cindex download
Packit aea12f
Packit aea12f
GnuTLS is available for download at:
Packit aea12f
@url{https://www.gnutls.org/download.html}
Packit aea12f
Packit aea12f
GnuTLS uses a development cycle where even minor version numbers
Packit aea12f
indicate a stable release and a odd minor version number indicate a
Packit aea12f
development release.  For example, GnuTLS 1.6.3 denote a stable
Packit aea12f
release since 6 is even, and GnuTLS 1.7.11 denote a development
Packit aea12f
release since 7 is odd.
Packit aea12f
Packit aea12f
GnuTLS depends on @code{nettle} and @code{gmplib}, and you will need to install it
Packit aea12f
before installing GnuTLS.  The @code{nettle} library is available from
Packit aea12f
@url{https://www.lysator.liu.se/~nisse/nettle/}, while @code{gmplib} is available
Packit aea12f
from @url{https://www.gmplib.org/}.
Packit aea12f
Don't forget to verify the cryptographic signature after downloading
Packit aea12f
source code packages.
Packit aea12f
Packit aea12f
The package is then extracted, configured and built like many other
Packit aea12f
packages that use Autoconf.  For detailed information on configuring
Packit aea12f
and building it, refer to the @file{INSTALL} file that is part of the
Packit aea12f
distribution archive.  Typically you invoke @code{./configure} and
Packit aea12f
then @code{make check install}.  There are a number of compile-time
Packit aea12f
parameters, as discussed below.
Packit aea12f
Packit aea12f
Several parts of GnuTLS require ASN.1 functionality, which is provided by 
Packit aea12f
a library called libtasn1.  A copy of libtasn1 is included in GnuTLS.  If you
Packit aea12f
want to install it separately (e.g., to make it possibly to use
Packit aea12f
libtasn1 in other programs), you can get it from
Packit aea12f
@url{https://www.gnu.org/software/libtasn1/}.
Packit aea12f
Packit aea12f
The compression library, @code{libz}, the PKCS #11 helper library @code{p11-kit},
Packit aea12f
the TPM library @code{trousers}, as well as the IDN library @code{libidn}@footnote{Needed
Packit aea12f
to use RFC6125 name comparison in internationalized domains.} are 
Packit aea12f
optional dependencies. Check the README file in the distribution on how
Packit aea12f
to obtain these libraries.
Packit aea12f
Packit aea12f
A few @code{configure} options may be relevant, summarized below.
Packit aea12f
They disable or enable particular features,
Packit aea12f
to create a smaller library with only the required features.
Packit aea12f
Note however, that although a smaller library is generated, the
Packit aea12f
included programs are not guaranteed to compile if some of these
Packit aea12f
options are given.
Packit aea12f
Packit aea12f
@verbatim
Packit aea12f
--disable-srp-authentication
Packit aea12f
--disable-psk-authentication
Packit aea12f
--disable-anon-authentication
Packit aea12f
--disable-dhe
Packit aea12f
--disable-ecdhe
Packit aea12f
--disable-openssl-compatibility
Packit aea12f
--disable-dtls-srtp-support
Packit aea12f
--disable-alpn-support
Packit aea12f
--disable-heartbeat-support
Packit aea12f
--disable-libdane
Packit aea12f
--without-p11-kit
Packit aea12f
--without-tpm
Packit aea12f
--without-zlib
Packit aea12f
Packit aea12f
@end verbatim
Packit aea12f
Packit aea12f
For the complete list, refer to the output from @code{configure --help}.
Packit aea12f
Packit aea12f
@node Installing for a software distribution
Packit aea12f
@section Installing for a software distribution
Packit aea12f
@cindex installation
Packit aea12f
Packit aea12f
When installing for a software distribution, it is often desirable to preconfigure
Packit aea12f
GnuTLS with the system-wide paths and files. There two important configuration
Packit aea12f
options, one sets the trust store in system, which are the CA certificates
Packit aea12f
to be used by programs by default (if they don't override it), and the other sets
Packit aea12f
to DNSSEC root key file used by unbound for DNSSEC verification.
Packit aea12f
Packit aea12f
For the latter the following configuration option is available, and if not specified
Packit aea12f
GnuTLS will try to auto-detect the location of that file.
Packit aea12f
@verbatim
Packit aea12f
--with-unbound-root-key-file
Packit aea12f
Packit aea12f
@end verbatim
Packit aea12f
Packit aea12f
To set the trust store the following options are available.
Packit aea12f
@verbatim
Packit aea12f
--with-default-trust-store-file
Packit aea12f
--with-default-trust-store-dir
Packit aea12f
--with-default-trust-store-pkcs11
Packit aea12f
Packit aea12f
@end verbatim
Packit aea12f
The first option is used to set a PEM file which contains a list of trusted certificates,
Packit aea12f
while the second will read all certificates in the given path. The recommended option is
Packit aea12f
the last, which allows to use a PKCS #11 trust policy module. That module not only
Packit aea12f
provides the trusted certificates, but allows the categorization of them using purpose,
Packit aea12f
e.g., CAs can be restricted for e-mail usage only, or administrative restrictions of CAs, for
Packit aea12f
examples by restricting a CA to only issue certificates for a given DNS domain using NameConstraints.
Packit Service 991b93
A publicly available PKCS #11 trust module is p11-kit's trust module@footnote{@url{https://p11-glue.github.io/p11-glue/trust-module.html}}.
Packit aea12f
Packit aea12f
@node Document overview
Packit aea12f
@section Overview
Packit aea12f
In this document we present an overview of the supported security protocols in @ref{Introduction to TLS}, and 
Packit aea12f
continue by providing more information on the certificate authentication in @ref{Certificate authentication},
Packit aea12f
and shared-key as well anonymous authentication in @ref{Shared-key and anonymous authentication}. We
Packit aea12f
elaborate on certificate authentication by demonstrating advanced usage of the API in @ref{More on certificate authentication}.
Packit aea12f
The core of the TLS library is presented in @ref{How to use GnuTLS in applications} and example
Packit aea12f
applications are listed in @ref{GnuTLS application examples}.
Packit aea12f
In @ref{Other included programs} the usage of few included programs that
Packit aea12f
may assist debugging is presented. The last chapter is @ref{Internal architecture of GnuTLS} that
Packit aea12f
provides a short introduction to GnuTLS' internal architecture.