如何在iphone上生成openssl 3des解密的密钥时间表

我需要解密一些在运行mono(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专业知识的人员,使用此库是项目的先决条件)     
已邀请:
DES_cblock
的typedef开始:
typedef unsigned char DES_cblock[8];
填写您自己的评论代码,并使用如下内容:
DES_key_schedule ks1, ks2, ks3;
DES_cblock key_8bytes;

/* ... copy the first 64 bits of the 192 bits into key_8bytes....*/
DES_set_key_unchecked(&key_8bytes, &ks1);

/* ... copy the second 64 bits of the 192 bits into key_8bytes....*/
DES_set_key_unchecked(&key_8bytes, &ks2);

/* ... copy the final 64 bits of the 192 bits into key_8bytes....*/
DES_set_key_unchecked(&key_8bytes, &ks3);
    

要回复问题请先登录注册