1EVP_KDF-X963(7ossl) OpenSSL EVP_KDF-X963(7ossl)
2
3
4
6 EVP_KDF-X963 - The X9.63-2001 EVP_KDF implementation
7
9 The EVP_KDF-X963 algorithm implements the key derivation function
10 (X963KDF). X963KDF is used by Cryptographic Message Syntax (CMS) for
11 EC KeyAgreement, to derive a key using input such as a shared secret
12 key and shared info.
13
14 Identity
15 "X963KDF" is the name for this implementation; it can be used with the
16 EVP_KDF_fetch() function.
17
18 Supported parameters
19 The supported parameters are:
20
21 "properties" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>
22 "digest" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>
23 These parameters work as described in "PARAMETERS" in EVP_KDF(3).
24
25 "key" (OSSL_KDF_PARAM_KEY) <octet string>
26 The shared secret used for key derivation. This parameter sets the
27 secret.
28
29 "info" (OSSL_KDF_PARAM_INFO) <octet string>
30 This parameter specifies an optional value for shared info.
31
33 X963KDF is very similar to the SSKDF that uses a digest as the
34 auxiliary function, X963KDF appends the counter to the secret, whereas
35 SSKDF prepends the counter.
36
37 A context for X963KDF can be obtained by calling:
38
39 EVP_KDF *kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
40 EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
41
42 The output length of an X963KDF is specified via the keylen parameter
43 to the EVP_KDF_derive(3) function.
44
46 This example derives 10 bytes, with the secret key "secret" and
47 sharedinfo value "label":
48
49 EVP_KDF *kdf;
50 EVP_KDF_CTX *kctx;
51 unsigned char out[10];
52 OSSL_PARAM params[4], *p = params;
53
54 kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
55 kctx = EVP_KDF_CTX_new(kdf);
56 EVP_KDF_free(kdf);
57
58 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
59 SN_sha256, strlen(SN_sha256));
60 *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
61 "secret", (size_t)6);
62 *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
63 "label", (size_t)5);
64 *p = OSSL_PARAM_construct_end();
65 if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
66 error("EVP_KDF_derive");
67 }
68
69 EVP_KDF_CTX_free(kctx);
70
72 "SEC 1: Elliptic Curve Cryptography"
73
75 EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3),
76 EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3),
77 EVP_KDF_derive(3), "PARAMETERS" in EVP_KDF(3)
78
80 This functionality was added in OpenSSL 3.0.
81
83 Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
84
85 Licensed under the Apache License 2.0 (the "License"). You may not use
86 this file except in compliance with the License. You can obtain a copy
87 in the file LICENSE in the source distribution or at
88 <https://www.openssl.org/source/license.html>.
89
90
91
923.0.9 2023-07-27 EVP_KDF-X963(7ossl)