1EVP_KDF_KRB5KDF(7)                  OpenSSL                 EVP_KDF_KRB5KDF(7)
2
3
4

NAME

6       EVP_KDF_KRB5KDF - The RFC3961 Krb5 KDF EVP_KDF implementation
7

DESCRIPTION

9       Support for computing the KRB5KDF KDF through the EVP_KDF API.
10
11       The EVP_KDF_KRB5KDF algorithm implements the key derivation function
12       defined in RFC 3961, section 5.1 and is used by Krb5 to derive session
13       keys.  Three inputs are required to perform key derivation: a cipher,
14       (for example AES-128-CBC), the initial key, and a constant.
15
16   Numeric identity
17       EVP_KDF_KRB5KDF is the numeric identity for this implementation; it can
18       be used with the EVP_KDF_CTX_new_id() function.
19
20   Supported controls
21       The supported controls are:
22
23       EVP_KDF_CTRL_SET_CIPHER
24       EVP_KDF_CTRL_SET_KEY
25           These controls work as described in "CONTROLS" in EVP_KDF_CTX(3).
26
27       EVP_KDF_CTRL_SET_KRB5KDF_CONSTANT
28           This control expects two arguments: "unsigned char *constant",
29           "size_t constantlen"
30
31           This control sets the constant value for the KDF.  If a value is
32           already set, the contents are replaced.
33

NOTES

35       A context for KRB5KDF can be obtained by calling:
36
37        EVP_KDF_CTX *kctx = EVP_KDF_CTX_new_id(EVP_KDF_KRB5KDF);
38
39       The output length of the KRB5KDF derivation is specified via the keylen
40       parameter to the EVP_KDF_derive(3) function, and MUST match the key
41       length for the chosen cipher or an error is returned. Moreover the
42       constant's length must not exceed the block size of the cipher.  Since
43       the KRB5KDF output length depends on the chosen cipher, calling
44       EVP_KDF_size() to obtain the requisite length returns the correct
45       length only after the cipher is set. Prior to that EVP_MAX_KEY_LENGTH
46       is returned.  The caller must allocate a buffer of the correct length
47       for the chosen cipher, and pass that buffer to the EVP_KDF_derive(3)
48       function along with that length.
49

EXAMPLES

51       This example derives a key using the AES-128-CBC cipher:
52
53        EVP_KDF_CTX *kctx;
54        unsigned char key[16] = "01234...";
55        unsigned char constant[] = "I'm a constant";
56        unsigned char out[16];
57        size_t outlen = sizeof(out);
58
59        kctx = EVP_KDF_CTX_new_id(EVP_KDF_KRB5KDF);
60
61        EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_CIPHER, EVP_aes_128_cbc());
62        EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_KEY, key, (size_t)16);
63        EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_KRB5KDF_CONSTANT, constant, strlen(constant));
64        if (EVP_KDF_derive(kctx, out, outlen) <= 0)
65            /* Error */
66        EVP_KDF_CTX_free(kctx);
67

CONFORMING TO

69       RFC 3961
70

SEE ALSO

72       EVP_KDF_CTX(3), EVP_KDF_CTX_new_id(3), EVP_KDF_CTX_free(3),
73       EVP_KDF_ctrl(3), EVP_KDF_size(3), EVP_KDF_derive(3), "CONTROLS" in
74       EVP_KDF_CTX(3)
75

HISTORY

77       This functionality was added to OpenSSL 3.0.
78
80       Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
81
82       Licensed under the OpenSSL license (the "License").  You may not use
83       this file except in compliance with the License.  You can obtain a copy
84       in the file LICENSE in the source distribution or at
85       <https://www.openssl.org/source/license.html>.
86
87
88
891.1.1l                            2021-09-15                EVP_KDF_KRB5KDF(7)
Impressum