简体   繁体   English

startActivity并拦截其他意图

[英]startActivity and intercept intent extras

I'm considering to do the following for log in a user: 我正在考虑为登录用户执行以下操作:

Intent intent= new Intent(this,DoLoginActivity.class);
intent.putExtra("login",mLogin);
intent.putExtra("password",mPassword);
startActivity(intent);

Is that secure, or other apps can easily listen/read the intent parameters? 这样安全吗,还是其他应用可以轻松听/读意图参数?

Your current approach is secure, no other app can listen or read these values. 您当前的方法是安全的,没有其他应用程序可以监听或读取这些值。

You are using Explicit intent [you actually specify the activity that is required to respond to the intent] and that is listen by only that class which is declared in Intent. 您正在使用Explicit intent [you actually specify the activity that is required to respond to the intent]并且仅由Intent中声明的类侦听。 So this is Secure. 所以这是安全的。

For your information you can pass object through intent, this will help in the scenario of passing bunch of values. 对于您的信息,您可以通过意图传递对象,这将在传递一堆值的情况下提供帮助。 Link 链接

为了增强安全性,应该将密码存储在char数组(char [])中,然后在使用后通过清除数组来清除密码,如下所示:

Arrays.fill(password, (char) 0);

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM