NCryptDecrypt internal consistency error RRS feed

  • Question

  • I have written code to encrypt and decrypt data. It all seems to work fine, if the data that gets encrypted has a size < 246.

    If it is 246 or greater, the encryption part works, but I get an error after calling the NCryptDecrypt function (An internal consistency check failed). 

    hResult = HRESULT_FROM_WIN32(NCryptDecrypt(hKey, encryptedData, blobsize, NULL, NULL, 0, (PDWORD)&cbSecret, BCRYPT_PAD_PKCS1));

    I have checked the block size and the block size is 256. Appreciate any pointers.

    Tuesday, December 11, 2012 11:16 PM