1SSL_export_keying_material(3) OpenSSL SSL_export_keying_material(3)
2
3
4
6 SSL_export_keying_material - obtain keying material for application use
7
9 #include <openssl/ssl.h>
10
11 int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
12 const char *label, size_t llen,
13 const unsigned char *context,
14 size_t contextlen, int use_context);
15
17 During the creation of a TLS or DTLS connection shared keying material
18 is established between the two endpoints. The function
19 SSL_export_keying_material() enables an application to use some of this
20 keying material for its own purposes in accordance with RFC5705.
21
22 An application may need to securely establish the context within which
23 this keying material will be used. For example this may include
24 identifiers for the application session, application algorithms or
25 parameters, or the lifetime of the context. The context value is left
26 to the application but must be the same on both sides of the
27 communication.
28
29 For a given SSL connection s, olen bytes of data will be written to
30 out. The application specific context should be supplied in the
31 location pointed to by context and should be contextlen bytes long.
32 Provision of a context is optional. If the context should be omitted
33 entirely then use_context should be set to 0. Otherwise it should be
34 any other value. If use_context is 0 then the values of context and
35 contextlen are ignored. Note that a zero length context is treated
36 differently to no context at all, and will result in different keying
37 material being returned.
38
39 An application specific label should be provided in the location
40 pointed to by label and should be llen bytes long. Typically this will
41 be a value from the IANA Exporter Label Registry
42 (<https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels>).
43 Alternatively labels beginning with "EXPERIMENTAL" are permitted by the
44 standard to be used without registration.
45
46 Note that this function is only defined for TLSv1.0 and above, and
47 DTLSv1.0 and above. Attempting to use it in SSLv3 will result in an
48 error.
49
51 SSL_export_keying_material() returns 0 or -1 on failure or 1 on
52 success.
53
55 Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
56
57 Licensed under the OpenSSL license (the "License"). You may not use
58 this file except in compliance with the License. You can obtain a copy
59 in the file LICENSE in the source distribution or at
60 <https://www.openssl.org/source/license.html>.
61
62
63
641.0.2o 2020-08-01 SSL_export_keying_material(3)