| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "EVP_KDF-KRB5KDF 7SSL" |
| 58 |
.TH EVP_KDF-KRB5KDF 7SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
EVP_KDF\-KRB5KDF \- The RFC3961 Krb5 KDF EVP_KDF implementation |
| 65 |
.SH DESCRIPTION |
| 66 |
.IX Header "DESCRIPTION" |
| 67 |
Support for computing the \fBKRB5KDF\fR KDF through the \fBEVP_KDF\fR API. |
| 68 |
.PP |
| 69 |
The EVP_KDF\-KRB5KDF algorithm implements the key derivation function defined |
| 70 |
in RFC 3961, section 5.1 and is used by Krb5 to derive session keys. |
| 71 |
Three inputs are required to perform key derivation: a cipher, (for example |
| 72 |
AES\-128\-CBC), the initial key, and a constant. |
| 73 |
.SS Identity |
| 74 |
.IX Subsection "Identity" |
| 75 |
"KRB5KDF" is the name for this implementation; |
| 76 |
it can be used with the \fBEVP_KDF_fetch()\fR function. |
| 77 |
.SS "Supported parameters" |
| 78 |
.IX Subsection "Supported parameters" |
| 79 |
The supported parameters are: |
| 80 |
.IP """properties"" (\fBOSSL_KDF_PARAM_PROPERTIES\fR) <UTF8 string>" 4 |
| 81 |
.IX Item """properties"" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>" |
| 82 |
.PD 0 |
| 83 |
.IP """cipher"" (\fBOSSL_KDF_PARAM_CIPHER\fR) <UTF8 string>" 4 |
| 84 |
.IX Item """cipher"" (OSSL_KDF_PARAM_CIPHER) <UTF8 string>" |
| 85 |
.IP """key"" (\fBOSSL_KDF_PARAM_KEY\fR) <octet string>" 4 |
| 86 |
.IX Item """key"" (OSSL_KDF_PARAM_KEY) <octet string>" |
| 87 |
.PD |
| 88 |
These parameters work as described in "PARAMETERS" in \fBEVP_KDF\fR\|(3). |
| 89 |
.IP """constant"" (\fBOSSL_KDF_PARAM_CONSTANT\fR) <octet string>" 4 |
| 90 |
.IX Item """constant"" (OSSL_KDF_PARAM_CONSTANT) <octet string>" |
| 91 |
This parameter sets the constant value for the KDF. |
| 92 |
If a value is already set, the contents are replaced. |
| 93 |
.SH NOTES |
| 94 |
.IX Header "NOTES" |
| 95 |
A context for KRB5KDF can be obtained by calling: |
| 96 |
.PP |
| 97 |
.Vb 2 |
| 98 |
\& EVP_KDF *kdf = EVP_KDF_fetch(NULL, "KRB5KDF", NULL); |
| 99 |
\& EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf); |
| 100 |
.Ve |
| 101 |
.PP |
| 102 |
The output length of the KRB5KDF derivation is specified via the \fIkeylen\fR |
| 103 |
parameter to the \fBEVP_KDF_derive\fR\|(3) function, and MUST match the key |
| 104 |
length for the chosen cipher or an error is returned. Moreover, the |
| 105 |
constant's length must not exceed the block size of the cipher. |
| 106 |
Since the KRB5KDF output length depends on the chosen cipher, calling |
| 107 |
\&\fBEVP_KDF_CTX_get_kdf_size\fR\|(3) to obtain the requisite length returns the correct length |
| 108 |
only after the cipher is set. Prior to that \fBEVP_MAX_KEY_LENGTH\fR is returned. |
| 109 |
The caller must allocate a buffer of the correct length for the chosen |
| 110 |
cipher, and pass that buffer to the \fBEVP_KDF_derive\fR\|(3) function along |
| 111 |
with that length. |
| 112 |
.SH EXAMPLES |
| 113 |
.IX Header "EXAMPLES" |
| 114 |
This example derives a key using the AES\-128\-CBC cipher: |
| 115 |
.PP |
| 116 |
.Vb 7 |
| 117 |
\& EVP_KDF *kdf; |
| 118 |
\& EVP_KDF_CTX *kctx; |
| 119 |
\& unsigned char key[16] = "01234..."; |
| 120 |
\& unsigned char constant[] = "I\*(Aqm a constant"; |
| 121 |
\& unsigned char out[16]; |
| 122 |
\& size_t outlen = sizeof(out); |
| 123 |
\& OSSL_PARAM params[4], *p = params; |
| 124 |
\& |
| 125 |
\& kdf = EVP_KDF_fetch(NULL, "KRB5KDF", NULL); |
| 126 |
\& kctx = EVP_KDF_CTX_new(kdf); |
| 127 |
\& EVP_KDF_free(kdf); |
| 128 |
\& |
| 129 |
\& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER, |
| 130 |
\& SN_aes_128_cbc, |
| 131 |
\& strlen(SN_aes_128_cbc)); |
| 132 |
\& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY, |
| 133 |
\& key, (size_t)16); |
| 134 |
\& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_CONSTANT, |
| 135 |
\& constant, strlen(constant)); |
| 136 |
\& *p = OSSL_PARAM_construct_end(); |
| 137 |
\& if (EVP_KDF_derive(kctx, out, outlen, params) <= 0) |
| 138 |
\& /* Error */ |
| 139 |
\& |
| 140 |
\& EVP_KDF_CTX_free(kctx); |
| 141 |
.Ve |
| 142 |
.SH "CONFORMING TO" |
| 143 |
.IX Header "CONFORMING TO" |
| 144 |
RFC 3961 |
| 145 |
.SH "SEE ALSO" |
| 146 |
.IX Header "SEE ALSO" |
| 147 |
\&\fBEVP_KDF\fR\|(3), |
| 148 |
\&\fBEVP_KDF_CTX_free\fR\|(3), |
| 149 |
\&\fBEVP_KDF_CTX_get_kdf_size\fR\|(3), |
| 150 |
\&\fBEVP_KDF_derive\fR\|(3), |
| 151 |
"PARAMETERS" in \fBEVP_KDF\fR\|(3) |
| 152 |
.SH HISTORY |
| 153 |
.IX Header "HISTORY" |
| 154 |
This functionality was added in OpenSSL 3.0. |
| 155 |
.SH COPYRIGHT |
| 156 |
.IX Header "COPYRIGHT" |
| 157 |
Copyright 2016\-2021 The OpenSSL Project Authors. All Rights Reserved. |
| 158 |
.PP |
| 159 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 160 |
this file except in compliance with the License. You can obtain a copy |
| 161 |
in the file LICENSE in the source distribution or at |
| 162 |
<https://www.openssl.org/source/license.html>. |