Revert "Merge branch 'upstream' into tizen"
[platform/upstream/gnutls.git] / doc / cha-crypto.texi
1 @node Using GnuTLS as a cryptographic library
2 @chapter Using GnuTLS as a cryptographic library
3
4 @acronym{GnuTLS} is not a low-level cryptographic library, i.e., 
5 it does not provide access to basic cryptographic primitives. However
6 it abstracts the internal cryptographic back-end (see @ref{Cryptographic Backend}),
7 providing symmetric crypto, hash and HMAC algorithms, as well access
8 to the random number generation.
9
10 @menu
11 * Symmetric algorithms::
12 * Public key algorithms::
13 * Hash and HMAC functions::
14 * Random number generation::
15 @end menu
16
17 @node Symmetric algorithms
18 @section Symmetric algorithms
19 @cindex symmetric algorithms
20 @cindex symmetric cryptography
21
22 The available functions to access symmetric crypto algorithms operations
23 are shown below. The supported algorithms are the algorithms required by the TLS protocol.
24 They are listed in @ref{tab:ciphers}.
25
26 @showfuncE{gnutls_cipher_init,gnutls_cipher_encrypt2,gnutls_cipher_decrypt2,gnutls_cipher_set_iv,gnutls_cipher_deinit}
27
28 In order to support authenticated encryption with associated data (AEAD) algorithms the following
29 functions are provided to set the associated data and retrieve the authentication tag.
30
31 @showfuncB{gnutls_cipher_add_auth,gnutls_cipher_tag}
32
33 @node Public key algorithms
34 @section Public key algorithms
35 @cindex public key algorithms
36
37 Public key cryptography algorithms such as RSA, DSA and ECDSA, can be
38 accessed using the abstract key API in @ref{Abstract key types}. This
39 is a high level API with the advantage of transparently handling keys
40 in memory and keys present in smart cards.
41
42 @node Hash and HMAC functions
43 @section Hash and HMAC functions
44 @cindex hash functions
45 @cindex HMAC functions
46
47 The available operations to access hash functions and hash-MAC (HMAC) algorithms
48 are shown below. HMAC algorithms provided keyed hash functionality. They supported HMAC algorithms are listed in @ref{tab:macs}.
49
50 @showfuncF{gnutls_hmac_init,gnutls_hmac,gnutls_hmac_output,gnutls_hmac_deinit,gnutls_hmac_get_len,gnutls_hmac_fast}
51
52 The available functions to access hash functions are shown below. The supported hash functions
53 are the same as the HMAC algorithms.
54
55 @showfuncF{gnutls_hash_init,gnutls_hash,gnutls_hash_output,gnutls_hash_deinit,gnutls_hash_get_len,gnutls_hash_fast}
56 @showfuncA{gnutls_fingerprint}
57
58 @node Random number generation
59 @section Random number generation
60 @cindex random numbers
61
62 Access to the random number generator is provided using the @funcref{gnutls_rnd}
63 function. It allows obtaining random data of various levels.
64
65 @showenumdesc{gnutls_rnd_level_t,The random number levels.}
66 @showfuncdesc{gnutls_rnd}