简体   繁体   English

在Java上加密信息并在Objective-C / C ++ / C上解密

[英]Encrypt information on Java and Decrypt it on Objective-C/C++/C

I'm trying to encrypt a string on Java and send it to an iOS device, so far I'm able to encrypt easily the string using this functions but the hard part is on iOS. 我正在尝试在Java上加密字符串并将其发送到iOS设备,到目前为止,我能够使用此功能轻松地对字符串进行加密,但最困难的部分是在iOS上。

On iOS I've been experimenting with different Blowfish libraries from http://www.schneier.com/blowfish-download.html but without success, the algorithms might not even be compatible with the Java output but I'm not sure so I'd like to ask for advice on decrypting this string on the device. 在iOS上,我一直在尝试http://www.schneier.com/blowfish-download.html上的不同Blowfish库,但没有成功,算法甚至可能与Java输出不兼容,但我不确定,所以我想寻求有关在设备上解密此字符串的建议。

Use AES256 or AES512 . 使用AES256AES512 Put an eye on salt and seed . 注意saltseed Or your encrypted string may not be readable after decrypting on other machine. 否则在其他计算机上解密后,您的加密字符串可能无法读取。

As the others have said, use AES instead of Blowfish. 正如其他人所说,使用AES代替河豚。 Even Schneier says not to use Blowfish - if you require extra security then use Serpent, otherwise use the standard. 甚至Schneier都说不要使用河豚-如果您需要额外的安全性,请使用Serpent,否则请使用标准。

In addition to using AES, I also recommend that you use Counter Mode - this encryption mode doesn't require padding, so that's one less thing you need to worry about when matching up your encryption and decryption methods. 除了使用AES外,我还建议您使用计数器模式 -这种加密模式不需要填充,因此在匹配加密和解密方法时,您无需担心其他事情。 However, you're fine with using any of the other NIST modes other than Electronic Codebook. 但是,您可以使用电子密码本以外的任何其他NIST模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM