且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将数据存储到android系统中的安全元素

更新时间:2023-02-17 16:10:17

如果您查看谷歌钱包常见问题解答您可以找到以下内容:

  •   

    您的付款凭据存储在一个名为包含在您的手机中的安全元件芯片。安全元件是从手机的主要操作系统和硬件的隔离。像谷歌钱包只有经过授权的程序可以访问安全元素开始交易。

  •   

    即使谷歌钱包本身具有非常有限的访问安全元素,不能读取或从内存中写入数据。有多个级别保护为存储在安全元素数据,它是保护在从窥视或篡改硬件级别

所以基本上......你没有访问这个 SecureElement 。与手机厂商也许说话给访问你访问/途径 SecureElement 将使你能够做到这一点......但我认为这将是超出你的范围。

编辑: 另一种解决方案可以将数据存储在一个的SQLite 数据库,也可以使用加密在该数据库,如 AES ...或者你preFER。你仍然要注意你如何保持/ distriubte的的加密/解密密钥

如果你担心的情况下,当有人失去了他的电话,以及创始人试图窃取数据,还可以实现你的应用程序的密码保护并且如果密码输入错误,连续3次,丢弃在数据存储在 SQLite的数据库

I want to create a google wallet like application in android. It is said that "all payment credentials are stored in a chip called the Secure Element contained within the phone". How can I access this secure element and store my card credentials into it. My aim is to use my phone (Nexus) at the checkout counter instead of my card.

So what I want is to store some data to the Secure Element chip and access the data when I tap on an NFC reader.

Thanks in advance.

If you check the Google Wallet FAQ you can find the following :

  • Your payment credentials are stored in a chip called the Secure Element contained within your phone. The Secure Element is isolated from your phone’s main operating system and hardware. Only authorized programs like Google Wallet can access the Secure Element to initiate a transaction.

  • Even Google Wallet itself has very limited access to the Secure Element, and cannot read or write data from its memory. There are multiple levels of protection for data stored on the Secure Element and it is protected at the hardware level from snooping or tampering.

So basically... you don't have access to this SecureElement. Maybe talking with the phone manufacturers to give you access/ ways of accessing the SecureElement will enable you to do this... but I think this would be out of your scope.

EDIT: An alternative solution can be storing your data in an SQLite database, and also use encryption on that database, such as AES... or whatever you prefer. You will still have to pay attention on how you keep/distriubte the encryption/decryption keys.

If you are worried about the case when somebody looses his phone, and the "founder" tries to steal the data, you can implement also an password protection on your Application and if the password is typed wrong 3 consecutive times, drop the SQLite database where the data is stored.