none
Forum for Cryptography Next Generation RRS feed

  • Question

  • Have an issue with BCryptGenerateSymmetricKey not producing the same key value as CryptDeriveKey from CRYPTOAPI library and need help.

    Jewettware

    Thursday, January 12, 2017 9:25 PM

Answers

  • After finding online documentation for CryptDeriveKey for CryptoAPI, the extended information allowed me to reproduce the same session/symmetric key using CNG as the CryptoAPI.

    Jewettware

    • Marked as answer by Jewettware Monday, January 16, 2017 7:22 PM
    Monday, January 16, 2017 7:22 PM

All replies

  • After finding online documentation for CryptDeriveKey for CryptoAPI, the extended information allowed me to reproduce the same session/symmetric key using CNG as the CryptoAPI.

    Jewettware

    • Marked as answer by Jewettware Monday, January 16, 2017 7:22 PM
    Monday, January 16, 2017 7:22 PM
  • Hello Jewettware, 

    can you please provide some mode details how did you solve the problem ?
    I'm new to the CNG and seams like faced wit the same problem as you did. In a nutshell, I need to encrypt/decrypt some data using the key generated based on the HASH from some passphrase. 

    I have a test utility that encrypts the data and I'd like to decrypt it but without success so far.  

    Here are steps of how I'm doing that

    1. using BCryptGetProperty to get the HASH of the passphrase

    2. pass the HASH to the BCryptGenerateSymmetricKey function to have a Key generate 

    3. use the key in the DCryptDecrypt API

    and it doesn't work for me. 

    The reason I write here is that in the document to that test utility it says that they uses CryptDeriveKey API to generate the Key from the HASH given. 

    Thanks

    • Edited by _clown_ Thursday, October 24, 2019 1:49 PM
    Thursday, October 24, 2019 1:49 PM