<div dir="ltr">Hi all,<div><br></div><div>As a follow-up, we found another proof showing the use of SHA2 is fine for a KDF.<div>This is from NIST's Recommendation for Key-Derivation Methods in Key-Establishment Schemes published in April 2018. (<a href="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr1.pdf">https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr1.pdf</a>)</div><div>It presents that an approved hash function (e.g., SHA256) can be used as a valid KDF.</div><div><br></div><div>Best,</div><div>Zhiyi</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 3, 2019 at 3:03 PM Zhiyi Zhang <<a href="mailto:zhiyi@cs.ucla.edu">zhiyi@cs.ucla.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi all,<div><br></div><div>I just checked the OpenSSL 1.0.2, I don't think pkcs5_pbkdf2_hmac_sha1 (Jeff T mentioned during Apr 3's NFD call) is exposed in 1.0.2. </div><div>Instead, I found this KDF in 1.0.2: EVP_BytesToKey (<a href="https://www.openssl.org/docs/man1.0.2/man3/EVP_BytesToKey.html" target="_blank">https://www.openssl.org/docs/man1.0.2/man3/EVP_BytesToKey.html</a>)</div><div>However, this website (<a href="https://www.cryptopp.com/wiki/OPENSSL_EVP_BytesToKey" target="_blank">https://www.cryptopp.com/wiki/OPENSSL_EVP_BytesToKey</a>) says </div><div>"</div><div><span style="font-family:"Helvetica Neue";font-size:12px">Early versions of EVP_BytesToKey used MD5, and later versions use SHA. MD5 is used in OpenSSL 1.0.2 and earlier. OpenSSL 1.1.0c and later use SHA-256 as the hash. Unless you have a specific need, you should not use OPENSSL_EVP_BytesToKey. Rather, you should use a password derivation function like HKDF or PBKDF2.</span></div><div>"</div><div>As we all know, MD5 has been deprecated as a crypto hash func, so my personal opinion is not to use this EVP_BytesToKey as NDNCERT's KDF.</div><div><br></div><div>As pointed out here (<a href="https://crypto.stackexchange.com/questions/50135/is-sha-2-suitable-for-key-derivation" target="_blank">https://crypto.stackexchange.com/questions/50135/is-sha-2-suitable-for-key-derivation</a>), I think using a raw SHA256 should be fine for our NDNCERT's KDF purpose, give the AES key will only be used in one cert request "session".</div><div><br></div><div>This will also avoid the OpenSSL version issue temporarily. When our NDN Testbed adopts a newer version of OpenSSL. We can bring the HKDF back.</div><div><br></div><div>Best,</div><div>Zhiyi</div></div></div>
</blockquote></div>