简体   繁体   English

加密密钥:可以使用混淆吗?

[英]Encryption key: Can I use obfuscation?

I am building an iOS app for someone. 我正在为某人构建一个iOS应用。 The app will be used to take mock exams on for a professional license. 该应用程序将用于进行模拟考试以获得专业许可。 The question data is stored in Core Data but the question and answers strings need to be encrypted as the client spent a lot of time writing them and doesn't want someone else stealing his work to use in a competing product. 问题数据存储在Core Data中,但是问题和答案字符串需要加密,因为客户花费大量时间编写它们,并且不希望其他人窃取他的作品以在竞争产品中使用。

So what I want to do is set the attributes in core data to transformable, use a custom NSValueTransformer to transform the strings to NSData and while they are being transformed use RNEncrypt to encrypt and decrypt. 因此,我要做的是将核心数据中的属性设置为可转换,使用自定义NSValueTransformer将字符串转换为NSData,然后在转换字符串时使用RNEncrypt进行加密和解密。

So far so good. 到现在为止还挺好。

Here is my predicament: I need to use a key to encrypt and decrypt the data but how do I get/create it? 这是我的困境:我需要使用密钥来加密和解密数据,但是如何获取/创建数据呢?

My options: 我的选择:

  • hardcode it == bad! 硬编码==不好!
  • generate key and store in keychain == not the right type of security. 生成密钥并将其存储在钥匙串中==不是正确的安全性类型。 ie. 即。 does not protect against owner of the device. 不能保护设备所有者。
  • generate key from user password == no other reason for the user to have to login. 从用户密码生成密钥==没有其他原因让用户必须登录。
  • the app connects to a server and gets a key with some authentication stuff(I don't know what is involved exactly) == I don't want to rely on a network connection for the app to work. 该应用程序连接到服务器并获取带有一些身份验证内容的密钥(我不知道确切涉及的内容)==我不想依靠网络连接来使该应用程序正常工作。
  • obfuscation, I feel like if I create a string from bits of other strings and method sigs and then hash it then that will be enough == It probably won't be. 混淆,我觉得如果我从其他字符串和方法sig的某个位创建一个字符串,然后对其进行哈希处理,那就足够了==可能不会。

My questions then are these: - Obfuscation, can it be enough, has anyone else had success with it? 我的问题是:-迷惑,足够了吗,其他人成功了吗? - From my research I've learnt that a hacker with an ipa can see all the hardcoded strings, class names and method sigs but they can't see the code inside the methods (is that correct?), so how could someone read the key if it was built up/generated inside a method? -从我的研究中,我了解到拥有ipa的黑客可以看到所有硬编码的字符串,类名和方法信号,但是他们看不到方法内部的代码(是正确的吗?),所以有人怎么读关键,如果它是建立在方法内部/生成的? - As the title, Can I use Obfuscation? -作为标题,我可以使用混淆吗? - Are there any options I have missed? -我有错过的任何选择吗?

For the record, if I have to then I'll make people register and login. 作为记录,如果需要的话,我将让人们注册和登录。

You cannot store data locally securely . 不能在本地安全地存储数据 As soon as you are able to decrypt it an attacker can as well. 一旦您能够解密它,攻击者也可以。 That goes for EVERY encryption technique. 这适用于每种加密技术。 No matter what you try. 无论您尝试什么。

You have to store the data or a different decryption key for each data point on a server and retrieve it one by one every time. 您必须为服务器上的每个数据点存储数据或不同的解密密钥,并每次都一次一个地检索它。 You additionally have to make sure that the user does not just send 100s of requests and retrieves all data by hand. 您还必须确保用户不仅发送100个请求,而且手工检索所有数据。

Note that storing just one key on a server will result in the exact same thing as writing it hardcoded in the app. 请注意,仅将一个密钥存储在服务器上将导致与在应用程序中进行硬编码完全相同的操作。 And not limiting the requests will just cause the attacker to need a little more time than just looking at an already decrypted local db. 不限制请求只会导致攻击者比查看已解密的本地数据库需要更多的时间。

Of course you can obfuscate it to make it seem like it has some good encryption behind it - but if someone WANTS to get the data, he will be able to. 当然,你可以混淆它,使其看起来像它有它背后的一些好的加密-但如果有人想要得到的数据,他就可以。

Regarding the code in an ipa: you will not be able to see the original code but you will be able to see some code that produces the same output as the original code. 关于IPA中的代码:您将无法看到原始代码,但是将能够看到一些与原始代码产生相同输出的代码。 As long as the device can produce the valid key, an attacker can as well. 只要设备可以产生有效密钥,攻击者也可以。

I do not know if there is a huge community out there that is looking through random apps to steal some of its internal questions / answers / data, I doubt it. 我不知道是否有一个庞大的社区正在寻找随机应用程序来窃取其一些内部问题/答案/数据,我对此表示怀疑。

You just have to make the product sooooo good that no competing product with the same data has any chance against it. 您只需要使产品好极了,就不会有任何具有相同数据的竞争产品都反对它。 The data itself can always be "stolen". 数据本身总是可以被“窃取”。

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

相关问题 使用512位非对称加密密钥来避免在应用中进行“包含加密” - use a 512 bit asymmetric encryption key to avoid 'contain encryption' in the app 从Watch应用程序调用父应用程序时如何使用文件加密? - How can I use file encryption when calling parent application from Watch app? 在iOS上是否可以通过设备密钥和应用专用密码使用硬件加密? - Is it possible on iOS to use the hardware encryption with the device key and an app specific passcode? 使用公钥加密 - Encryption using public key 在使用字典之前,必须先释放字典中的键 - Key in dictionary gets deallocated before I can use it NSUserDefaults setObject和IntegerForKey,在同一密钥上使用,如果没有,我该如何解决? - NSUserDefaults setObject and IntegerForKey, use on the same key, if not how can I workaround? 我可以在Realm.IO中使用孩子的主键作为父母的主键吗? - Can I use a child's primary key as the parent's primary key in Realm.IO? 我可以在另一个Info.plist键值的内部使用Info.plist中一个键的值吗? - Can I use the value for one key in Info.plist inside the value of another Info.plist key? 在ios中使用ecc进行加密 - Use ecc for encryption in ios 我的 AES 加密有问题我的密钥基于 64 字符串,数据加密错误 - i have a problem with AES encryption the key i have is based 64 string , the data encrypted wrong
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM