如何在iOS中添加盐并使用objective c检索它而不会出现内存泄漏 [英] How to add salt in iOS and retrieving it using objective c without memory leakage

查看:31
本文介绍了如何在iOS中添加盐并使用objective c检索它而不会出现内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过在 iOS 中使用目标 c 将 IV 附加到 AES 加密/解密代码,并且能够对其进行解密和加密.现在我正在尝试将盐添加到 AES 加密中,但不幸的是它对我不起作用.

I have appended the IV to the AES Encryption/decryption code by using objective c in iOS and able to decrypt and encrypt the same. Right now I am trying to add the salt to the AES Encryption but unfortunately its not working for me.

推荐答案

您延长了加密密钥,但并未延长解密密钥.解密代码从不调用 AESKeyForPassword,而且我看不到任何地方存储盐以将其发送到解密器(将 IV 发送到解密器的方式).您不能只将 PBKDF2 应用于一侧.这为您提供了完全不同的密钥.

You're stretching your encryption key, but you're not stretching your decryption key. The decryption code never calls AESKeyForPassword, and I don't see anywhere that you store the salt to send it to the decryptor (the way you send the IV to the decryptor). You can't just apply PBKDF2 to one side. That gives you completely different keys.

这篇关于如何在iOS中添加盐并使用objective c检索它而不会出现内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆