Home | History | Annotate | Line # | Download | only in man1
      1  1.1  christos =pod
      2  1.1  christos {- OpenSSL::safe::output_do_not_edit_headers(); -}
      3  1.1  christos 
      4  1.1  christos =head1 NAME
      5  1.1  christos 
      6  1.1  christos openssl-kdf - perform Key Derivation Function operations
      7  1.1  christos 
      8  1.1  christos =head1 SYNOPSIS
      9  1.1  christos 
     10  1.1  christos B<openssl kdf>
     11  1.1  christos [B<-help>]
     12  1.1  christos [B<-cipher>]
     13  1.1  christos [B<-digest>]
     14  1.1  christos [B<-mac>]
     15  1.1  christos [B<-kdfopt> I<nm>:I<v>]
     16  1.1  christos [B<-keylen> I<num>]
     17  1.1  christos [B<-out> I<filename>]
     18  1.1  christos [B<-binary>]
     19  1.1  christos {- $OpenSSL::safe::opt_provider_synopsis -}
     20  1.1  christos I<kdf_name>
     21  1.1  christos 
     22  1.1  christos =head1 DESCRIPTION
     23  1.1  christos 
     24  1.1  christos The key derivation functions generate a derived key from either a secret or
     25  1.1  christos password.
     26  1.1  christos 
     27  1.1  christos =head1 OPTIONS
     28  1.1  christos 
     29  1.1  christos =over 4
     30  1.1  christos 
     31  1.1  christos =item B<-help>
     32  1.1  christos 
     33  1.1  christos Print a usage message.
     34  1.1  christos 
     35  1.1  christos =item B<-keylen> I<num>
     36  1.1  christos 
     37  1.1  christos The output size of the derived key. This field is required.
     38  1.1  christos 
     39  1.1  christos =item B<-out> I<filename>
     40  1.1  christos 
     41  1.1  christos Filename to output to, or standard output by default.
     42  1.1  christos 
     43  1.1  christos =item B<-binary>
     44  1.1  christos 
     45  1.1  christos Output the derived key in binary form. Uses hexadecimal text format if not specified.
     46  1.1  christos 
     47  1.1  christos =item B<-cipher> I<name>
     48  1.1  christos 
     49  1.1  christos Specify the cipher to be used by the KDF.
     50  1.1  christos Not all KDFs require a cipher and it is an error to use this option in such
     51  1.1  christos cases.
     52  1.1  christos 
     53  1.1  christos =item B<-digest> I<name>
     54  1.1  christos 
     55  1.1  christos Specify the digest to be used by the KDF.
     56  1.1  christos Not all KDFs require a digest and it is an error to use this option in such
     57  1.1  christos cases.
     58  1.1  christos To see the list of supported digests, use C<openssl list -digest-commands>.
     59  1.1  christos 
     60  1.1  christos =item B<-mac> I<name>
     61  1.1  christos 
     62  1.1  christos Specify the MAC to be used by the KDF.
     63  1.1  christos Not all KDFs require a MAC and it is an error to use this option in such
     64  1.1  christos cases.
     65  1.1  christos 
     66  1.1  christos =item B<-kdfopt> I<nm>:I<v>
     67  1.1  christos 
     68  1.1  christos Passes options to the KDF algorithm.
     69  1.1  christos A comprehensive list of parameters can be found in L<EVP_KDF(3)/PARAMETERS>.
     70  1.1  christos Common parameter names used by EVP_KDF_CTX_set_params() are:
     71  1.1  christos 
     72  1.1  christos =over 4
     73  1.1  christos 
     74  1.1  christos =item B<key:>I<string>
     75  1.1  christos 
     76  1.1  christos Specifies the secret key as an alphanumeric string (use if the key contains
     77  1.1  christos printable characters only).
     78  1.1  christos The string length must conform to any restrictions of the KDF algorithm.
     79  1.1  christos A key must be specified for most KDF algorithms.
     80  1.1  christos 
     81  1.1  christos =item B<hexkey:>I<string>
     82  1.1  christos 
     83  1.1  christos Alternative to the B<key:> option where
     84  1.1  christos the secret key is specified in hexadecimal form (two hex digits per byte).
     85  1.1  christos 
     86  1.1  christos =item B<pass:>I<string>
     87  1.1  christos 
     88  1.1  christos Specifies the password as an alphanumeric string (use if the password contains
     89  1.1  christos printable characters only).
     90  1.1  christos The password must be specified for PBKDF2 and scrypt.
     91  1.1  christos 
     92  1.1  christos =item B<hexpass:>I<string>
     93  1.1  christos 
     94  1.1  christos Alternative to the B<pass:> option where
     95  1.1  christos the password is specified in hexadecimal form (two hex digits per byte).
     96  1.1  christos 
     97  1.1  christos =item B<salt:>I<string>
     98  1.1  christos 
     99  1.1  christos Specifies a non-secret unique cryptographic salt as an alphanumeric string
    100  1.1  christos (use if it contains printable characters only).
    101  1.1  christos The length must conform to any restrictions of the KDF algorithm.
    102  1.1  christos A salt parameter is required for several KDF algorithms,
    103  1.1  christos such as L<EVP_KDF-PBKDF2(7)>.
    104  1.1  christos 
    105  1.1  christos =item B<hexsalt:>I<string>
    106  1.1  christos 
    107  1.1  christos Alternative to the B<salt:> option where
    108  1.1  christos the salt is specified in hexadecimal form (two hex digits per byte).
    109  1.1  christos 
    110  1.1  christos =item B<info:>I<string>
    111  1.1  christos 
    112  1.1  christos Some KDF implementations, such as L<EVP_KDF-HKDF(7)>, take an 'info' parameter
    113  1.1  christos for binding the derived key material
    114  1.1  christos to application- and context-specific information.
    115  1.1  christos Specifies the info, fixed info, other info or shared info argument
    116  1.1  christos as an alphanumeric string (use if it contains printable characters only).
    117  1.1  christos The length must conform to any restrictions of the KDF algorithm.
    118  1.1  christos 
    119  1.1  christos =item B<hexinfo:>I<string>
    120  1.1  christos 
    121  1.1  christos Alternative to the B<info:> option where
    122  1.1  christos the info is specified in hexadecimal form (two hex digits per byte).
    123  1.1  christos 
    124  1.1  christos =item B<digest:>I<string>
    125  1.1  christos 
    126  1.1  christos This option is identical to the B<-digest> option.
    127  1.1  christos 
    128  1.1  christos =item B<cipher:>I<string>
    129  1.1  christos 
    130  1.1  christos This option is identical to the B<-cipher> option.
    131  1.1  christos 
    132  1.1  christos =item B<mac:>I<string>
    133  1.1  christos 
    134  1.1  christos This option is identical to the B<-mac> option.
    135  1.1  christos 
    136  1.1  christos =back
    137  1.1  christos 
    138  1.1  christos {- $OpenSSL::safe::opt_provider_item -}
    139  1.1  christos 
    140  1.1  christos =item I<kdf_name>
    141  1.1  christos 
    142  1.1  christos Specifies the name of a supported KDF algorithm which will be used.
    143  1.1  christos The supported algorithms names include TLS1-PRF, HKDF, SSKDF, PBKDF2,
    144  1.1  christos SSHKDF, X942KDF-ASN1, X942KDF-CONCAT, X963KDF and SCRYPT.
    145  1.1  christos 
    146  1.1  christos =back
    147  1.1  christos 
    148  1.1  christos =head1 EXAMPLES
    149  1.1  christos 
    150  1.1  christos Use TLS1-PRF to create a hex-encoded derived key from a secret key and seed:
    151  1.1  christos 
    152  1.1  christos     openssl kdf -keylen 16 -kdfopt digest:SHA2-256 -kdfopt key:secret \
    153  1.1  christos                 -kdfopt seed:seed TLS1-PRF
    154  1.1  christos 
    155  1.1  christos Use HKDF to create a hex-encoded derived key from a secret key, salt and info:
    156  1.1  christos 
    157  1.1  christos     openssl kdf -keylen 10 -kdfopt digest:SHA2-256 -kdfopt key:secret \
    158  1.1  christos                 -kdfopt salt:salt -kdfopt info:label HKDF
    159  1.1  christos 
    160  1.1  christos Use SSKDF with KMAC to create a hex-encoded derived key from a secret key, salt and info:
    161  1.1  christos 
    162  1.1  christos     openssl kdf -keylen 64 -kdfopt mac:KMAC-128 -kdfopt maclen:20 \
    163  1.1  christos                 -kdfopt hexkey:b74a149a161545 -kdfopt hexinfo:348a37a2 \
    164  1.1  christos                 -kdfopt hexsalt:3638271ccd68a2 SSKDF
    165  1.1  christos 
    166  1.1  christos Use SSKDF with HMAC to create a hex-encoded derived key from a secret key, salt and info:
    167  1.1  christos 
    168  1.1  christos     openssl kdf -keylen 16 -kdfopt mac:HMAC -kdfopt digest:SHA2-256 \
    169  1.1  christos                 -kdfopt hexkey:b74a149a -kdfopt hexinfo:348a37a2 \
    170  1.1  christos                 -kdfopt hexsalt:3638271c SSKDF
    171  1.1  christos 
    172  1.1  christos Use SSKDF with Hash to create a hex-encoded derived key from a secret key, salt and info:
    173  1.1  christos 
    174  1.1  christos     openssl kdf -keylen 14 -kdfopt digest:SHA2-256 \
    175  1.1  christos                 -kdfopt hexkey:6dbdc23f045488 \
    176  1.1  christos                 -kdfopt hexinfo:a1b2c3d4 SSKDF
    177  1.1  christos 
    178  1.1  christos Use SSHKDF to create a hex-encoded derived key from a secret key, hash and session_id:
    179  1.1  christos 
    180  1.1  christos     openssl kdf -keylen 16 -kdfopt digest:SHA2-256 \
    181  1.1  christos                 -kdfopt hexkey:0102030405 \
    182  1.1  christos                 -kdfopt hexxcghash:06090A \
    183  1.1  christos                 -kdfopt hexsession_id:01020304 \
    184  1.1  christos                 -kdfopt type:A SSHKDF
    185  1.1  christos 
    186  1.1  christos Use PBKDF2 to create a hex-encoded derived key from a password and salt:
    187  1.1  christos 
    188  1.1  christos     openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:password \
    189  1.1  christos                 -kdfopt salt:salt -kdfopt iter:2 PBKDF2
    190  1.1  christos 
    191  1.1  christos Use scrypt to create a hex-encoded derived key from a password and salt:
    192  1.1  christos 
    193  1.1  christos     openssl kdf -keylen 64 -kdfopt pass:password -kdfopt salt:NaCl \
    194  1.1  christos                 -kdfopt n:1024 -kdfopt r:8 -kdfopt p:16 \
    195  1.1  christos                 -kdfopt maxmem_bytes:10485760 SCRYPT
    196  1.1  christos 
    197  1.1  christos =head1 NOTES
    198  1.1  christos 
    199  1.1  christos The KDF mechanisms that are available will depend on the options
    200  1.1  christos used when building OpenSSL.
    201  1.1  christos 
    202  1.1  christos =head1 SEE ALSO
    203  1.1  christos 
    204  1.1  christos L<openssl(1)>,
    205  1.1  christos L<openssl-pkeyutl(1)>,
    206  1.1  christos L<EVP_KDF(3)>,
    207  1.1  christos L<EVP_KDF-SCRYPT(7)>,
    208  1.1  christos L<EVP_KDF-TLS1_PRF(7)>,
    209  1.1  christos L<EVP_KDF-PBKDF2(7)>,
    210  1.1  christos L<EVP_KDF-HKDF(7)>,
    211  1.1  christos L<EVP_KDF-SS(7)>,
    212  1.1  christos L<EVP_KDF-SSHKDF(7)>,
    213  1.1  christos L<EVP_KDF-X942-ASN1(7)>,
    214  1.1  christos L<EVP_KDF-X942-CONCAT(7)>,
    215  1.1  christos L<EVP_KDF-X963(7)>
    216  1.1  christos 
    217  1.1  christos =head1 HISTORY
    218  1.1  christos 
    219  1.1  christos Added in OpenSSL 3.0
    220  1.1  christos 
    221  1.1  christos =head1 COPYRIGHT
    222  1.1  christos 
    223  1.1  christos Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
    224  1.1  christos 
    225  1.1  christos Licensed under the Apache License 2.0 (the "License").  You may not use
    226  1.1  christos this file except in compliance with the License.  You can obtain a copy
    227  1.1  christos in the file LICENSE in the source distribution or at
    228  1.1  christos L<https://www.openssl.org/source/license.html>.
    229  1.1  christos 
    230  1.1  christos =cut
    231