163 lines
5.7 KiB
HTML
Executable File
163 lines
5.7 KiB
HTML
Executable File
<?xml version="1.0" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>EVP_KDF-KRB5KDF</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<link rev="made" href="mailto:root@localhost" />
|
|
</head>
|
|
|
|
<body style="background-color: white">
|
|
|
|
|
|
<!-- INDEX BEGIN -->
|
|
<div name="index">
|
|
<p><a name="__index__"></a></p>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#name">NAME</a></li>
|
|
<li><a href="#description">DESCRIPTION</a></li>
|
|
<ul>
|
|
|
|
<li><a href="#identity">Identity</a></li>
|
|
<li><a href="#supported_parameters">Supported parameters</a></li>
|
|
</ul>
|
|
|
|
<li><a href="#notes">NOTES</a></li>
|
|
<li><a href="#examples">EXAMPLES</a></li>
|
|
<li><a href="#conforming_to">CONFORMING TO</a></li>
|
|
<li><a href="#see_also">SEE ALSO</a></li>
|
|
<li><a href="#history">HISTORY</a></li>
|
|
<li><a href="#copyright">COPYRIGHT</a></li>
|
|
</ul>
|
|
|
|
<hr name="index" />
|
|
</div>
|
|
<!-- INDEX END -->
|
|
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="name">NAME</a></h1>
|
|
<p>EVP_KDF-KRB5KDF - The <a href="http://www.ietf.org/rfc/rfc3961.txt" class="rfc">RFC3961</a> Krb5 KDF EVP_KDF implementation</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p>Support for computing the <strong>KRB5KDF</strong> KDF through the <strong>EVP_KDF</strong> API.</p>
|
|
<p>The EVP_KDF-KRB5KDF algorithm implements the key derivation function defined
|
|
in <a href="http://www.ietf.org/rfc/rfc3961.txt" class="rfc">RFC 3961</a>, section 5.1 and is used by Krb5 to derive session keys.
|
|
Three inputs are required to perform key derivation: a cipher, (for example
|
|
AES-128-CBC), the initial key, and a constant.</p>
|
|
<p>
|
|
</p>
|
|
<h2><a name="identity">Identity</a></h2>
|
|
<p>"KRB5KDF" is the name for this implementation;
|
|
it can be used with the <code>EVP_KDF_fetch()</code> function.</p>
|
|
<p>
|
|
</p>
|
|
<h2><a name="supported_parameters">Supported parameters</a></h2>
|
|
<p>The supported parameters are:</p>
|
|
<dl>
|
|
<dt><strong><a name="properties_ossl_kdf_param_properties_utf8_string" class="item">"properties" (<strong>OSSL_KDF_PARAM_PROPERTIES</strong>) <UTF8 string></a></strong></dt>
|
|
|
|
<dt><strong><a name="cipher_ossl_kdf_param_cipher_utf8_string" class="item">"cipher" (<strong>OSSL_KDF_PARAM_CIPHER</strong>) <UTF8 string></a></strong></dt>
|
|
|
|
<dt><strong><a name="key_ossl_kdf_param_key_octet_string" class="item">"key" (<strong>OSSL_KDF_PARAM_KEY</strong>) <octet string></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>These parameters work as described in <em>EVP_KDF(3)/PARAMETERS</em>.</p>
|
|
</dd>
|
|
<dt><strong><a name="constant_ossl_kdf_param_constant_octet_string" class="item">"constant" (<strong>OSSL_KDF_PARAM_CONSTANT</strong>) <octet string></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This parameter sets the constant value for the KDF.
|
|
If a value is already set, the contents are replaced.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="notes">NOTES</a></h1>
|
|
<p>A context for KRB5KDF can be obtained by calling:</p>
|
|
<pre>
|
|
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "KRB5KDF", NULL);
|
|
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);</pre>
|
|
<p>The output length of the KRB5KDF derivation is specified via the <em>keylen</em>
|
|
parameter to the <em>EVP_KDF_derive(3)</em> function, and MUST match the key
|
|
length for the chosen cipher or an error is returned. Moreover the
|
|
constant's length must not exceed the block size of the cipher.
|
|
Since the KRB5KDF output length depends on the chosen cipher, calling
|
|
<em>EVP_KDF_size(3)</em> to obtain the requisite length returns the correct length
|
|
only after the cipher is set. Prior to that <strong>EVP_MAX_KEY_LENGTH</strong> is returned.
|
|
The caller must allocate a buffer of the correct length for the chosen
|
|
cipher, and pass that buffer to the <em>EVP_KDF_derive(3)</em> function along
|
|
with that length.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="examples">EXAMPLES</a></h1>
|
|
<p>This example derives a key using the AES-128-CBC cipher:</p>
|
|
<pre>
|
|
EVP_KDF *kdf;
|
|
EVP_KDF_CTX *kctx;
|
|
unsigned char key[16] = "01234...";
|
|
unsigned char constant[] = "I'm a constant";
|
|
unsigned char out[16];
|
|
size_t outlen = sizeof(out);
|
|
OSSL_PARAM params[4], *p = params;</pre>
|
|
<pre>
|
|
kdf = EVP_KDF_fetch(NULL, "KRB5KDF", NULL);
|
|
kctx = EVP_KDF_CTX_new(kdf);
|
|
EVP_KDF_free(kdf);</pre>
|
|
<pre>
|
|
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER,
|
|
SN_aes_128_cbc,
|
|
strlen(SN_aes_128_cbc));
|
|
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
|
|
key, (size_t)16);
|
|
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_CONSTANT,
|
|
constant, strlen(constant));
|
|
*p = OSSL_PARAM_construct_end();
|
|
if (EVP_KDF_set_params(kctx, params) <= 0)
|
|
/* Error */</pre>
|
|
<pre>
|
|
if (EVP_KDF_derive(kctx, out, outlen) <= 0)
|
|
/* Error */</pre>
|
|
<pre>
|
|
EVP_KDF_CTX_free(kctx);</pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="conforming_to">CONFORMING TO</a></h1>
|
|
<p>RFC 3961</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="see_also">SEE ALSO</a></h1>
|
|
<p><em>EVP_KDF(3)</em>,
|
|
<em>EVP_KDF_CTX_free(3)</em>,
|
|
<em>EVP_KDF_ctrl(3)</em>,
|
|
<em>EVP_KDF_size(3)</em>,
|
|
<em>EVP_KDF_derive(3)</em>,
|
|
<em>EVP_KDF(3)/PARAMETERS</em></p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="history">HISTORY</a></h1>
|
|
<p>This functionality was added to OpenSSL 3.0.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
|
<p>Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.</p>
|
|
<p>Licensed under the OpenSSL license (the "License"). You may not use
|
|
this file except in compliance with the License. You can obtain a copy
|
|
in the file LICENSE in the source distribution or at
|
|
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
|
|
|
|
</body>
|
|
|
|
</html>
|