dongliang1996 2019-01-25 15:37
浏览 224

使用php解密ssl加密的pcap文件

I have to build a rest api, which can receive an ssl encrypted pcap file and the ssl key for it from an android device in a multipart/formdata post. The php should decrypt and store the file. I'm trying to use openssl for it like this:

$method = "AES-128-CBC";
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
$decrypted = openssl_decrypt(file_get_contents($encryptedFile), $method, file_get_contents($sslKeyFile), OPENSSL_RAW_DATA, $iv);
if ($decrypted === false)
{
    while ($msg = openssl_error_string())
        echo $msg . "<br />
";
    exit;
}

Testing with the snakeoil packet from https://wiki.wireshark.org/SampleCaptures#SSL_with_decryption_keys , i'm getting errors like below:

error:0607A082:digital envelope routines:EVP_CIPHER_CTX_set_key_length:invalid key length   
error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length   

Can somebody advice what am i doing wrong, or how to do this properly?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程
    • ¥20 模型在y分布之外的数据上预测能力不好如何解决