Поможите с расшифровкой файла - при попытке импортировать сессионный ключ происходит NTE_BAD_DATA,
в массиве msg.CSK загружен сессионный ключ из файла, в pExchPubKeyBlob открытый ключ.
if not CryptAcquireContext(@hProv, PChar('ВВВ'), '', 75, 0) then showmessage('Error provider');
if not CryptGetUserKey(hProv, AT_KEYEXCHANGE, @TempKey)then ShowMessage('CryptGetUserKey: ' + ErrToStr(GetLastError));
if not CryptExportKey(TempKey, 0,PUBLICKEYBLOB, 0, nil, @dwPubBlobLen) then ShowMessage('CryptExportKey: ' + ErrToStr(GetLastError));
setlength(pExchPubKeyBlob,dwPubBlobLen);
if not CryptExportKey(TempKey, 0,PUBLICKEYBLOB, 0, @pExchPubKeyBlob[0], @dwPubBlobLen) then ShowMessage('CryptExportKey: ' + ErrToStr(GetLastError));
if not CryptGetUserKey(hProv, AT_KEYEXCHANGE, @hK)then ShowMessage('CryptGetUserKey: ' + ErrToStr(GetLastError));
if not CryptImportKey(hProv, @pExchPubKeyBlob[0], dwPubBlobLen, hk, CRYPT_EXPORTABLE, @KeyExchKey) then ShowMessage('Ошибка импорта ключа: ' + ErrToStr(GetLastError));
if not CryptImportKey(hProv, @msg.CSK[0],msg.LenCSK, KeyExchKey, 0, @SessionKey) then ShowMessage('Ошибка импорта ключа: ' + ErrToStr(GetLastError));