【问题标题】:Can I access a HTTP cookie in my webview natively from Android?我可以从 Android 本地访问我的 web 视图中的 HTTP cookie 吗?
【发布时间】:2014-04-09 23:14:47
【问题描述】:

我正在编写一个 Cordova 应用程序,我想从插件访问它的 HTTP 安全 cookie。我想加密/禁用它,直到用户输入有效的密码。

非常感谢所有帮助。谢谢。

【问题讨论】:

    标签: android http cordova webview session-cookies


    【解决方案1】:

    我的做法是启用/禁用整个应用程序的 cookie:

    CookieManager mCookieManager = CookieManager.getInstance();
    CookieSyncManager.createInstance(this);
    mCookieManager.setAcceptCookie(false); //disables cookies for the WebView until the user enters a correct pin
    
    if(getUsersPin()) { //getUsersPin() gets the pin from the user
        mCookieManager.setAcceptCookie(true);
    }
    

    【讨论】:

    • 如果攻击者获得了设备,cookie 将被保存在磁盘上。这是我要阻止的向量。该应用正在保护关键信息。
    • cookie 在应用数据中受到保护,因此除非设备已获得 root 权限,否则获取设备的人无法访问它们。您似乎要求的是加密 cookie 数据库本身,我不知道该怎么做,但是如果您已经制定了加密方法,只需加密保存 cookie 的 .db 文件。它位于您应用的 /data 文件夹中。
    • @returneax 参考这个问题stackoverflow.com/questions/4275311/… 以加密/解密 cookie 文件。
    猜你喜欢
    • 2011-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-22
    • 1970-01-01
    • 2010-12-11
    • 2011-11-26
    • 1970-01-01
    相关资源
    最近更新 更多