我需要解密一些在运行单声道(C#)的系统上经过 3des 编码的数据
我需要在 iPhone 上使用 openssl 和解密。
我找到了一个看起来像这样的示例,当我安装了 openssl 等时,它在 iphone 上运行没有错误,但是为我在编码系统上验证的测试用例生成了错误的结果。初始化向量是正确的,但是我应该将密钥计划设置为什么,因为我拥有的唯一信息是输入?
DES_cblock ivec[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
DES_key_schedule ks1, ks2, ks3;
// What (and how) should I set ks1/2/3 to?
DES_ede3_cbc_encrypt(input,output, 24*8, &ks1, &ks2, &ks3,ivec, DES_DECRYPT);
单声道系统的解码使用以下代码完成;
TripleDESCryptoServiceProvider m_des = new TripleDESCryptoServiceProvider();
byte[] IV ={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
m_des.KeySize = 24*8;
MemoryStream memStream = new MemoryStream();
CryptoStream cryptStream = new CryptoStream(memStream,m_des.CreateDecryptor(key, IV), CryptoStreamMode.Write);
cryptStream.Write(input, 0, input.Length);
cryptStream.FlushFinalBlock();
据我所知,没有指定关键时间表,所以我不知道将其设置为什么?我猜它是从钥匙中衍生出来的……一分钱开始下降……但是如何呢?
有任何想法吗?(最好来自具有 openssl 专业知识的人,使用这个库是项目的先决条件)