Objective-C,如何模糊或加密NSString? [英] Objective-C, how to obfuscate or encrypt NSString?

查看:88
本文介绍了Objective-C,如何模糊或加密NSString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



但是我仍然可以调用在需要的时候容易地放置文件路径。
我搜索了一个答案,但我看到的一切都是专门针对iOS或似乎过于复杂。



我只想使用这样的东西:

   - (void)method {

NSString * obfuscate = @/ path / to / something / secret; //加密或模糊化

[self manageFiles:obfuscate]

- (void)manageFiles(NSString *)obfuscate {

NSFileManager * [[NSFileManager alloc] init];

如果([文件fileExistsAtPath:obfuscate])

...。

- 感谢您的帮助,谢谢。

解决方案

(这是一个旧问题,但我还在回复)



在Obj- C。 Obj-C具有足够的动态性,这些方法中的任何一种都可以被捕获和拦截。不要在绝对需要秘密的应用程序中运送任何东西。如果您的应用程序是在越狱电话上运行,或者是在盗版网站上提供的,而不是已经暴露出来,并且内存内容被转储。以上所有这些方法将解码后的数据复制到显示在其中的主内存。



请参阅:
https://www.youtube.com/watch?v=Ii-02vhsdVk



以上这些方法都不是安全的。再次,请勿将这些内容嵌入到您的应用程序中,确保它们实际上是安全的。


I have an NSString (which is a path to a file) in my code that I would like to somehow obfuscate or encrypt,

but still be able to call up the file path easily when needed. I searched for an answer to this, but everything I've seen either deals specifically with iOS or seems overly complicated.

I would simply like to use it with something such as this:

- (void)method {

NSString *obfuscate = @"/path/to/something/secret"; // encrypt or obfuscate

[self manageFiles:obfuscate]

- (void)manageFiles(NSString *)obfuscate {

    NSFileManager *files = [[NSFileManager alloc] init];

    if ([files fileExistsAtPath:obfuscate])

    ... .

— any help is appreciated, thank you.

解决方案

(This is an old question, but I'm replying anyway)

There's no such way to in Obj-C. Obj-C is dynamic enough that any of these methods can be trapped and intercepted. Do not ship anything in a application that absolutely needs to be secret. If your application is run on a jailbroken phone, or if it is made available on piracy sites, than it has already been exposed and it's memory contents dumped. All these above methods copy the decoded data to main memory where it is exposed.

See: https://www.youtube.com/watch?v=Ii-02vhsdVk

None of these methods above is actually secure. Again, do not embed these sorts of things in your applications with an assurance they are actually secure.

这篇关于Objective-C,如何模糊或加密NSString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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