如何在跨应用程序发送 Intent 数据时保护其安全

发布于 2024-12-08 04:56:10 字数 188 浏览 0 评论 0原文

我正在研究我的 Android 应用程序的安全方面。

我想知道在将 Intent 数据和附加内容从一个应用程序发送到另一个应用程序时保护其安全的方法,以便除了这两个应用程序之外没有其他应用程序可以窥探它。

其中一种暴力方法是使用android的加密解密来编码意图数据,有没有更好的方法来实现相同的效果?

提前致谢。

I am working on the security aspects of my android application.

I would like to know about the ways to secure the Intent data and extras while sending it from one application to another so that no other application other than these two can snoop it.

One of the brute-force approaches would be to use android's encryption-decryption to encode intent data, is there a better way to achieve the same ??

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

℉絮湮 2024-12-15 04:56:10

正如其他答案中所指出的,尽管您可以将意图发送到完全合格的活动,但没有什么可以阻止某人使用相同的包创建应用程序。

您可能想为此方案添加一个额外的安全步骤:

  • 首先向远程活动发送“挑战”意图(例如,它应该使用共享密码加密您提供的随机字符串并将其发送回给您) )。

  • 如果第一个安全步骤没问题,您可以使用其完全限定的活动自由地将未加密的消息发送到此远程应用。

这是相当蹩脚的安全性,但也许足以满足您的需求。


请看看下面 CommonsWare 的评论。

更安全的方法可能是将您的活动编码为绑定服务,保持挑战步骤,但通过更私密的通信。

As pointed in the other answers, although you can send an intent to a fully qualified activity, nothing prevents someone from creating an application with the same package.

You might want to add an additional security step to this scheme:

  • First send a 'Challenge' intent to the remote activity (it should, for example, encrypt a random string you provided using a shared passphrase and send it back to you).

  • If that first security step is ok, you may freely send unencrypted messages to this remote app by using its fully qualified activity.

This is rather lame security, but perhaps it's sufficient for your needs.


Please take a look at CommonsWare's comment below.

A more secure way might be to code your activity as a Bound Service, keeping the Challenge step, but by means of more private communication.

故人如初 2024-12-15 04:56:10

我的猜测是,如果您使用显式意图,即指定意图发送到的类,那么没有其他类可以拦截该意图并查看其数据。
但是,如果您尝试将信息发送到的应用程序中的类名称发生更改,则此方法可能会失败。

My guess is that if you use an explicit intent, i.e. specifying the class to which the intent is to be sent to, then no other class can intercept that intent and look at its data.
This method however, may fail if the class name in the application that you're trying to send the information to changes.

过潦 2024-12-15 04:56:10

如果意图指定目标,该目标是发送者应用程序包的一部分,那么其他应用程序将没有机会捕获它 - 它将被传递到预期的接收者。

另一方面,如果您将意图发送到另一个应用程序,则无法保证意图的接收者将获得您期望的实现:如果您将意图发送到 com.mycompany.security.SecureReceiver,而不是您的应用程序,使用给定的类描述安装另一个应用程序,然后您将向该应用程序发送您的意图。

此外,Android 是一个开放系统。如果有人编译了自己的应用程序框架,那么他就可以操纵 Intent 传递系统。

您想保护您的数据免受用户或恶意应用程序的侵害吗?

If an intent specifies the the target, which is part of the sender application's package, then other applications won't have the chance to capture it - it will be delivered to the intended receiver.

On the other hand, if you send an intent to another application, there is no guarantee that the receiver of the intent will have the implementation you expect: if you send your intent to com.mycompany.security.SecureReceiver, but instead of your application, another application is installed with the given class description, than you will send your intent to that application.

Also, Android is an open system. If someone compiles his own application framework, than he can manipulate the Intent delivery system.

Do you want to protect your data from the user, or from malicious applications?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文