Encrypt and Decrypt iOS/Node.js Security Inquiry

一个人想着一个人 提交于 2019-12-04 11:31:14

Typically a random salt is used and prepended to the encrypted data. It is also common to all prepend the PBKDF2 iteration count along with a version number helps for future-proofing. Finally, skipping an iv reduces the protection of the first block and you might consider an authentication hash.

This is similar to what RNCryptor does. See RNCryptor-Spec-v3.md for a detail of a encrypted message.

Notes:
I don't understand CC_SHA256 of the salt, that shouldn't be necessary.

NSData* outputMessage = [NSMutableData dataWithBytes:decrypted.mutableBytes length:bytesDecrypted];
is unnecessary, just set the length of decrypted
decrypted.length = bytesDecrypted;
and use decrypted in place of outputMessage.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!