[go: up one dir, main page]

CN115146253A - A mobile App login method, mobile device and system - Google Patents

A mobile App login method, mobile device and system Download PDF

Info

Publication number
CN115146253A
CN115146253A CN202110342507.5A CN202110342507A CN115146253A CN 115146253 A CN115146253 A CN 115146253A CN 202110342507 A CN202110342507 A CN 202110342507A CN 115146253 A CN115146253 A CN 115146253A
Authority
CN
China
Prior art keywords
server
login
mobile app
automatic
electronic equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110342507.5A
Other languages
Chinese (zh)
Inventor
李赤阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Petal Cloud Technology Co Ltd
Original Assignee
Petal Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Petal Cloud Technology Co Ltd filed Critical Petal Cloud Technology Co Ltd
Priority to CN202110342507.5A priority Critical patent/CN115146253A/en
Publication of CN115146253A publication Critical patent/CN115146253A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the application provides a mobile App login method, mobile equipment and a system, and relates to the technical field of terminals. The electronic equipment receives a user name and a login password of the mobile App, acquires an automatic login key pair generated and stored in the TEE, and submits a first login request comprising the user name, the login password and a public key of the automatic login key pair to the server; the server generates an automatic login credential according to the first login request and sends the automatic login credential to the electronic device; the electronic equipment responds to the operation of opening the mobile App by the user, and provides a second login request to the server, wherein the second login request comprises a first signature result and an automatic login credential; the first signature result is obtained by adopting a private key to sign a local timestamp of the electronic equipment; and the server verifies the first signature result according to the public key in the automatic login credential of the second login request, and if the verification is passed, the mobile App is successfully logged in. Therefore, the risk of revealing the authentication credential can be reduced, and the safety of the mobile App login process is enhanced.

Description

一种移动App登录方法、移动设备及系统A mobile App login method, mobile device and system

技术领域technical field

本申请涉及终端技术领域,尤其涉及一种移动App登录方法、移动设备及系统。The present application relates to the field of terminal technologies, and in particular, to a mobile App login method, mobile device and system.

背景技术Background technique

很多移动应用程序(application,App)需要登录用户账号,确定用户的身份之后才能使用。这些移动App通常分为服务端和客户端。在客户端输入用户名和登录密码后,将用户名和登录密码提交到服务端进行认证。认证通过后,客户端和服务端在一定时间段内会保持用户的登录状态。很多移动App设计成用户账号长期处于登录状态,以避免用户每次打开应用程序时都输入一遍用户名和登录密码。为了让移动App长期保持登录状态,通常在客户端设备中保存认证凭据,供服务端认证客户端的身份。Many mobile applications (application, App) need to log in to a user account, and the user's identity can be used before they can be used. These mobile apps are usually divided into server and client. After the client enters the user name and login password, submit the user name and login password to the server for authentication. After the authentication is passed, the client and server will keep the user's login status for a certain period of time. Many mobile apps are designed so that the user account is logged in for a long time to avoid the user having to enter the user name and login password every time the app is opened. In order to keep the mobile app logged in for a long time, authentication credentials are usually stored in the client device for the server to authenticate the identity of the client.

由于客户端设备有被黑客入侵的风险,保存在客户端设备上的认证凭据存在泄漏风险。如果黑客在其他设备上仿冒用户身份,会对用户造成损失。因此,如何防止认证凭据泄漏,是亟待解决的问题。Since the client device is at risk of being hacked, there is a risk of leakage of authentication credentials stored on the client device. If the hacker impersonates the user's identity on other devices, it will cause losses to the user. Therefore, how to prevent the leakage of authentication credentials is an urgent problem to be solved.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种移动App登录方法、移动设备及系统,能够降低认证凭据泄露风险,增强移动App登录过程安全性。The embodiments of the present application provide a mobile App login method, mobile device and system, which can reduce the risk of authentication credential leakage and enhance the security of the mobile App login process.

为达到上述目的,本申请采用如下技术方案:To achieve the above object, the application adopts the following technical solutions:

第一方面,本申请提供一种移动App登录方法,应用于电子设备,电子设备包括可信执行环境TEE,该方法包括:电子设备接收用户输入的移动应用程序App的用户名和登录密码;电子设备生成自动登录密钥对;自动登录密钥对包括公钥和私钥,自动登录密钥对由TEE生成和保存;电子设备向服务器发送第一登录请求,第一登录请求用于请求登录移动App;第一登录请求包括用户名,登录密码和公钥;电子设备接收自动登录凭据;自动登录凭据是根据用户名和公钥生成的;电子设备接收用户打开移动App的操作;响应于打开移动App的操作,电子设备向服务器发送第二登录请求,第二登录请求用于请求登录移动App;第二登录请求包括第一签名结果和自动登录凭据,第一签名结果是采用私钥对电子设备的本地时间戳进行签名生成的;自动登录凭据用于验证第一签名结果。In a first aspect, the present application provides a mobile App login method, which is applied to an electronic device. The electronic device includes a Trusted Execution Environment (TEE), and the method includes: the electronic device receives a user name and a login password of a mobile application App entered by a user; the electronic device Generate an automatic login key pair; the automatic login key pair includes a public key and a private key, and the automatic login key pair is generated and saved by the TEE; the electronic device sends a first login request to the server, and the first login request is used to request to log in to the mobile App The first login request includes a user name, a login password and a public key; the electronic device receives the automatic login credentials; the automatic login credentials are generated according to the user name and the public key; the electronic device receives the operation of the user opening the mobile App; Operation, the electronic device sends a second login request to the server, and the second login request is used to request to log in to the mobile App; the second login request includes a first signature result and an automatic login credential, and the first signature result is a local key to the electronic device using the private key. Timestamp for signature generation; automatic login credentials are used to verify the first signature result.

在该方法中,在电子设备的TEE中生成和保存不可导出的自动登录密钥对,并向服务器提交用户名、登录密码以及自动登录密钥对的公钥后,接收自动登录凭据。自动登录凭据将自动登录密钥对和用户身份信息进行了绑定,把对用户身份的认证转化为对自动登录密钥对的认证。这样,即使REE被入侵,只要TEE未被攻破,用户的身份信息便无法被窃取。利用了TEE中自动登录密钥对的不可导出防止了用户的登录凭据被窃取,增强了移动App登录过程的安全性,降低了认证凭据被泄漏的风险。In this method, a non-exportable automatic login key pair is generated and saved in the TEE of the electronic device, and after submitting the user name, login password and the public key of the automatic login key pair to the server, the automatic login credentials are received. The automatic login credentials bind the automatic login key pair with the user identity information, and convert the authentication of the user identity into the authentication of the automatic login key pair. In this way, even if the REE is hacked, as long as the TEE is not compromised, the user's identity information cannot be stolen. The non-export of the automatic login key pair in the TEE is used to prevent the user's login credentials from being stolen, enhance the security of the mobile App login process, and reduce the risk of authentication credentials being leaked.

结合第一方面,在一种可能的实现方式中,该方法还包括:电子设备从服务器接收会话标识,会话标识为电子设备与服务器之间传输数据的凭证。With reference to the first aspect, in a possible implementation manner, the method further includes: the electronic device receives a session identifier from the server, where the session identifier is a credential for data transmission between the electronic device and the server.

也就是说,手动登录和每次自动登录时都产生新的会话标识,会话标识的保存时间可以设置的较短;比如,会话标识只在用户登录移动App到关闭移动App的期间保存;会话标识保存的时间较短。这样,会话标识可以保存在移动设备的内存中;相对于较长时间得将会话标识保存在磁盘中,更安全。That is to say, a new session ID is generated each time you log in manually and each time you log in automatically, and the storage time of the session ID can be set to a short time; The storage time is shorter. In this way, the session ID can be stored in the memory of the mobile device; it is safer to save the session ID in the disk for a long time.

结合第一方面,在一种可能的实现方式中,该方法还包括:第二登录请求还包括电子设备的本地时间戳。With reference to the first aspect, in a possible implementation manner, the method further includes: the second login request further includes a local timestamp of the electronic device.

结合第一方面,在一种可能的实现方式中,该方法还包括:电子设备从服务器接收该服务器的当前时间;电子设备向服务器发送第三登录请求,第三登录请求包括服务器的当前时间,第二签名结果和自动登录凭据;第二签名结果是采用私钥对服务器的当前时间进行签名生成的。这样,可实现移动设备时间不准确情况下的容错处理。容错处理的登录流程和正常的登录流程相同,可以简化服务端程序的开发工作和空间占用。With reference to the first aspect, in a possible implementation manner, the method further includes: the electronic device receives the current time of the server from the server; the electronic device sends a third login request to the server, where the third login request includes the current time of the server, The second signature result and the automatic login credentials; the second signature result is generated by using the private key to sign the current time of the server. In this way, fault-tolerant processing in the event that the time of the mobile device is inaccurate can be realized. The login process of fault-tolerant processing is the same as the normal login process, which can simplify the development work and space occupation of the server program.

结合第一方面,在一种可能的实现方式中,该方法还包括:在电子设备向服务器发送第二登录请求之前,电子设备对用户进行生物特征验证,生物特征验证包括指纹识别,面部识别,虹膜识别中至少一项。这样,在每次登录移动App过程中均可验证用户身份,即使移动设备丢失或被其他人临时借用,也无法冒用用户身份登录移动App,提高了移动App登录安全性。With reference to the first aspect, in a possible implementation manner, the method further includes: before the electronic device sends the second login request to the server, the electronic device performs biometric verification on the user, and the biometric verification includes fingerprint recognition, facial recognition, At least one of iris recognition. In this way, the user's identity can be verified during each login process of the mobile app. Even if the mobile device is lost or temporarily borrowed by others, it is impossible to use the user's identity to log in to the mobile app, which improves the security of mobile app login.

第二方面,本申请实施例提供一种移动App登录方法,该方法包括:服务器接收第一登录请求,第一登录请求用于请求登录移动App;第一登录请求包括移动App的用户名和登录密码以及自动登录密钥对的公钥;服务器根据用户名和公钥生成自动登录凭据;服务器向电子设备发送自动登录凭据;服务器接收第二登录请求,第二登录请求用于请求登录移动App;第二登录请求包括签名结果和自动登录凭据,签名结果为采用自动登录密钥对的私钥对电子设备的本地时间戳进行签名得到的;服务器解密自动登录凭据,验证该自动登录凭据的完整性;如果验证自动登录凭据的完整性通过,服务器根据自动登录凭据获取公钥,根据公钥对签名结果进行验证;如果根据公钥对签名结果进行验证通过,服务器确定登录移动App成功。In a second aspect, an embodiment of the present application provides a mobile App login method, the method includes: the server receives a first login request, where the first login request is used to request to log in to the mobile App; the first login request includes a user name and a login password of the mobile App and the public key of the automatic login key pair; the server generates the automatic login credentials according to the user name and the public key; the server sends the automatic login credentials to the electronic device; the server receives the second login request, and the second login request is used to request to log in to the mobile App; The login request includes a signature result and an automatic login credential, and the signature result is obtained by using the private key of the automatic login key pair to sign the local timestamp of the electronic device; the server decrypts the automatic login credential and verifies the integrity of the automatic login credential; if If the integrity of the automatic login credentials is verified, the server obtains the public key according to the automatic login credentials, and verifies the signature result according to the public key; if the verification of the signature result according to the public key is passed, the server determines that the login to the mobile app is successful.

在该方法中,服务器根据第一登录请求将用户名与自动登录密钥对进行绑定,生成自动登录凭据,发送给电子设备。并利用自动登录凭据中自动登录密钥对的公钥验证签名结果,把对用户身份的认证转化为对自动登录密钥对的认证,防止了用户的登录凭据被窃取,增强了移动App登录过程的安全性,降低了认证凭据被泄漏的风险。这样,服务器侧也不需要存储和查找用户身份信息与自动登录密钥对的绑定关系。降低了自动登录过程中服务器的数据检索时间和数据存储空间,登录效率不受用户规模的影响。可以在用户规模比较大的场景下,提升登录过程的效率。In this method, the server binds a user name and an automatic login key pair according to the first login request, generates an automatic login credential, and sends it to the electronic device. And use the public key of the automatic login key pair in the automatic login credentials to verify the signature result, convert the authentication of the user's identity into the authentication of the automatic login key pair, prevent the user's login credentials from being stolen, and enhance the mobile App login process. security, reducing the risk of authentication credentials being leaked. In this way, the server side also does not need to store and search for the binding relationship between the user identity information and the automatic login key pair. The data retrieval time and data storage space of the server during the automatic login process are reduced, and the login efficiency is not affected by the user scale. It can improve the efficiency of the login process in scenarios with a large user scale.

结合第二方面,在一种可能的实现方式中,该方法还包括:服务器根据用户名和公钥生成自动登录凭据包括:服务器对用户名和公钥进行加密,生成自动登录凭据。With reference to the second aspect, in a possible implementation manner, the method further includes: generating the automatic login credential by the server according to the user name and the public key includes: the server encrypting the user name and the public key to generate the automatic login credential.

在一种可能的设计方式中,密钥模块采用对称加密密钥进行加密,并使用带额外认证数据的认证加密(authenticated encryption with associated data,AEAD)模式,如GCM(Galois/counter mode)、CCM(counter mode with CBC-MAC)模式。这样,可以同时保证被加密数据的机密性和完整性。In a possible design, the key module uses a symmetric encryption key for encryption, and uses an authenticated encryption with associated data (AEAD) mode with additional authentication data, such as GCM (Galois/counter mode), CCM (counter mode with CBC-MAC) mode. In this way, the confidentiality and integrity of the encrypted data can be guaranteed at the same time.

结合第二方面,在一种可能的实现方式中,该方法还包括:在根据公钥对签名结果进行验证之前,验证签名结果在服务器不存在。With reference to the second aspect, in a possible implementation manner, the method further includes: before verifying the signature result according to the public key, verifying that the signature result does not exist on the server.

也就是说,将电子设备提交的签名结果作为防重放攻击的检查项,可以实现对重放攻击的有效检测。若在服务器检测到签名结果不存在,则认为不是重放攻击,这样既能保证准确性,又不需要引入额外的信息。That is to say, using the signature result submitted by the electronic device as a check item for preventing replay attacks can realize effective detection of replay attacks. If the server detects that the signature result does not exist, it is considered not to be a replay attack, which can ensure accuracy without introducing additional information.

结合第二方面,在一种可能的实现方式中,该方法还包括:服务器包括一个或多个布隆过滤器,一个布隆过滤器用于存储一个时间范围内的签名结果;第二登录请求还包括电子设备的本地时间戳;验证签名结果在服务器不存在,包括:根据第二登录请求中电子设备的本地时间戳获取一个或多个布隆过滤器中第一布隆过滤器;验证第二登录请求中签名结果在第一布隆过滤器中不存在。With reference to the second aspect, in a possible implementation manner, the method further includes: the server includes one or more bloom filters, and one bloom filter is used to store the signature results within a time range; the second login request further includes: Including the local timestamp of the electronic device; verifying that the signature result does not exist on the server, including: obtaining the first Bloom filter in the one or more Bloom filters according to the local timestamp of the electronic device in the second login request; verifying the second The signed result in the login request does not exist in the first bloom filter.

在一种可能的设计方式中,通过把设定的时间误差范围划分为多个时间片段,并在每个时间片段创建一个布隆过滤器,在该布隆过滤器中保存对应时间片段的签名结果。随着时间的变化,之前创建的布隆过滤器对应的时间片段就会超出设定的时间误差范围,删除超出设定的时间误差范围的布隆过滤器,可以解决布隆过滤器内信息无法删除的问题。这样,服务器仅需要保存最大时间误差范围内的签名结果,而且也只需要对某一个时间片段内的签名结果进行检查,既节省了服务器的存储空间,而且查询过程耗时较短,大大提升了检测效率。In a possible design method, by dividing the set time error range into multiple time segments, and creating a bloom filter in each time segment, the signature of the corresponding time segment is saved in the bloom filter result. As time changes, the time segment corresponding to the previously created Bloom filter will exceed the set time error range. Deleting the Bloom filter that exceeds the set time error range can solve the problem that the information in the Bloom filter cannot be Deleted question. In this way, the server only needs to save the signature results within the maximum time error range, and only needs to check the signature results in a certain time segment, which not only saves the storage space of the server, but also takes less time for the query process, which greatly improves the detection efficiency.

结合第二方面,在一种可能的实现方式中,该方法还包括:在根据第二登录请求中电子设备的本地时间戳获取一个或多个布隆过滤器中第一布隆过滤器之前,确定第二登录请求中电子设备的本地时间戳与服务器的当前时间之间的差值小于设定的时间误差范围。这样,不需要额外的网络交互就能实现用户登录。同时,还可以过滤掉不在时间误差范围内的登录请求,缩小重放攻击的检测范围。With reference to the second aspect, in a possible implementation manner, the method further includes: before obtaining the first bloom filter in the one or more bloom filters according to the local timestamp of the electronic device in the second login request, It is determined that the difference between the local timestamp of the electronic device and the current time of the server in the second login request is less than a set time error range. In this way, user login can be achieved without additional network interaction. At the same time, it can also filter out login requests that are not within the time error range, reducing the detection range of replay attacks.

结合第二方面,在一种可能的实现方式中,该方法还包括:如果第二登录请求中电子设备的本地时间戳与服务器的当前时间之间的差值大于或等于设定的时间误差范围,服务器向电子设备发送服务器的当前时间。这样,可实现移动设备时间不准确情况下的容错处理。容错处理的登录流程和正常的登录流程相同,可以简化服务端程序的开发工作和空间占用。With reference to the second aspect, in a possible implementation manner, the method further includes: if the difference between the local timestamp of the electronic device in the second login request and the current time of the server is greater than or equal to a set time error range , the server sends the current time of the server to the electronic device. In this way, fault-tolerant processing in the event that the time of the mobile device is inaccurate can be realized. The login process of fault-tolerant processing is the same as the normal login process, which can simplify the development work and space occupation of the server program.

结合第二方面,在一种可能的实现方式中,该方法还包括:在服务器根据用户名和公钥生成自动登录凭据之前,服务器对用户名和登录密码进行验证。这样,可以确认用户身份的真实性。With reference to the second aspect, in a possible implementation manner, the method further includes: before the server generates automatic login credentials according to the user name and the public key, the server verifies the user name and the login password. In this way, the authenticity of the user's identity can be confirmed.

结合第二方面,在一种可能的实现方式中,该方法还包括:服务器确定登录移动App成功后,服务器向电子设备发送会话标识,会话标识为电子设备与服务器之间传输数据的凭证。With reference to the second aspect, in a possible implementation manner, the method further includes: after the server determines that the login to the mobile App is successful, the server sends a session identifier to the electronic device, where the session identifier is a credential for data transmission between the electronic device and the server.

也就是说,手动登录和每次自动登录时都产生新的会话标识,会话标识的保存时间可以设置的较短;比如,会话标识只在用户登录移动App到关闭移动App的期间保存;会话标识保存的时间较短。这样,会话标识可以保存在移动设备的内存中;相对于较长时间得将会话标识保存在磁盘中,更安全。That is to say, a new session ID is generated each time you log in manually and each time you log in automatically, and the storage time of the session ID can be set to a short time; The storage time is shorter. In this way, the session ID can be stored in the memory of the mobile device; it is safer to save the session ID in the disk for a long time.

第三方面,本申请提供一种移动App登录方法,该方法包括:电子设备接收用户输入的移动应用程序App的用户名和登录密码;电子设备生成自动登录密钥对;自动登录密钥对包括公钥和私钥,自动登录密钥对由TEE生成和保存;电子设备向服务器发送第一登录请求,第一登录请求用于请求登录移动App;第一登录请求包括用户名,登录密码和公钥;服务器接收第一登录请求,根据用户名和公钥生成自动登录凭据;服务器向电子设备发送自动登录凭据;电子设备接收用户打开移动App的操作;响应于打开移动App的操作,电子设备向服务器提交第二登录请求,第二登录请求用于请求登录移动App;第二登录请求包括第一签名结果和自动登录凭据,第一签名结果为采用私钥对电子设备的本地时间戳进行签名得到的;服务器接收第二登录请求,根据第二登录请求获取第一签名结果和自动登录凭据;服务器解密自动登录凭据,验证自动登录凭据的完整性;如果验证自动登录凭据的完整性通过,服务器根据自动登录凭据获取公钥,根据公钥对第一签名结果进行验证;如果根据公钥对第一签名结果进行验证通过,服务器确定登录移动App成功。In a third aspect, the present application provides a mobile App login method. The method includes: an electronic device receives a user name and a login password of a mobile application program App input by a user; the electronic device generates an automatic login key pair; the automatic login key pair includes a public key pair. key and private key, the automatic login key pair is generated and saved by the TEE; the electronic device sends a first login request to the server, and the first login request is used to request to log in to the mobile App; the first login request includes the user name, login password and public key The server receives the first login request, and generates automatic login credentials according to the user name and the public key; the server sends the automatic login credentials to the electronic device; the electronic device receives the operation of the user opening the mobile App; in response to the operation of opening the mobile App, the electronic device submits to the server The second login request, the second login request is used to request to log in to the mobile App; the second login request includes a first signature result and an automatic login credential, and the first signature result is obtained by using a private key to sign the local timestamp of the electronic device; The server receives the second login request, and obtains the first signature result and the automatic login credential according to the second login request; the server decrypts the automatic login credential and verifies the integrity of the automatic login credential; The public key is obtained by the credentials, and the first signature result is verified according to the public key; if the verification of the first signature result is passed according to the public key, the server determines that the login to the mobile App is successful.

在该方法中,在电子设备的TEE中生成和保存不可导出的自动登录密钥对,并向服务器提交第一登录请求,服务器根据第一登录请求将用户名与自动登录密钥对进行绑定,生成自动登录凭据,发送给电子设备。自动登录凭据将自动登录密钥对和用户名等用户身份信息进行了绑定,服务器利用自动登录凭据中自动登录密钥对的公钥验证签名结果,验证通过,确认登录成功,把对用户身份的认证转化为对自动登录密钥对的认证,防止了用户的登录凭据被窃取,增强了移动App登录过程的安全性,降低了认证凭据被泄漏的风险。这样,即使REE被入侵,只要TEE未被攻破,用户的身份信息便无法被窃取。服务器侧也不需要存储和查找用户身份信息与自动登录密钥对的绑定关系。降低了自动登录过程中服务器的数据检索时间和数据存储空间,登录效率不受用户规模的影响。可以在用户规模比较大的场景下,提升登录过程的效率。In this method, a non-exportable automatic login key pair is generated and saved in the TEE of the electronic device, and a first login request is submitted to the server, and the server binds the user name and the automatic login key pair according to the first login request , which generates automatic login credentials and sends them to the electronic device. The automatic login credentials bind the user identity information such as the automatic login key pair and the user name. The server uses the public key of the automatic login key pair in the automatic login credentials to verify the signature result. If the verification is passed, the login is confirmed to be successful. The authentication of the mobile app is transformed into the authentication of the automatic login key pair, which prevents the user's login credentials from being stolen, enhances the security of the mobile app login process, and reduces the risk of authentication credentials being leaked. In this way, even if the REE is hacked, as long as the TEE is not compromised, the user's identity information cannot be stolen. The server side also does not need to store and search for the binding relationship between the user identity information and the automatic login key pair. The data retrieval time and data storage space of the server during the automatic login process are reduced, and the login efficiency is not affected by the user scale. It can improve the efficiency of the login process in scenarios with a large user scale.

结合第三方面,在一种可能的实现方式中,该方法还包括:服务器确定登录移动App成功后,服务器向电子设备发送会话标识,会话标识为电子设备与服务器之间传输数据的凭证;电子设备接收会话标识。With reference to the third aspect, in a possible implementation manner, the method further includes: after the server determines that the login to the mobile App is successful, the server sends a session identifier to the electronic device, where the session identifier is a credential for data transmission between the electronic device and the server; The device receives the session ID.

也就是说,手动登录和每次自动登录时都产生新的会话标识,会话标识的保存时间可以设置的较短;比如,会话标识只在用户登录移动App到关闭移动App的期间保存;会话标识保存的时间较短。这样,会话标识可以保存在移动设备的内存中;相对于较长时间得将会话标识保存在磁盘中,更安全。That is to say, a new session ID is generated each time you log in manually and each time you log in automatically, and the storage time of the session ID can be set to a short time; The storage time is shorter. In this way, the session ID can be stored in the memory of the mobile device; it is safer to save the session ID in the disk for a long time.

结合第三方面,在一种可能的实现方式中,该方法还包括:在电子设备向服务器发送第二登录请求之前,电子设备对用户进行生物特征验证,生物特征验证包括指纹识别,面部识别,虹膜识别中至少一项。这样,在每次登录移动App过程中均可验证用户身份,即使移动设备丢失或被其他人临时借用,也无法冒用用户身份登录移动App,提高了移动App登录安全性。With reference to the third aspect, in a possible implementation manner, the method further includes: before the electronic device sends the second login request to the server, the electronic device performs biometric verification on the user, and the biometric verification includes fingerprint recognition, facial recognition, At least one of iris recognition. In this way, the user's identity can be verified during each login process of the mobile app. Even if the mobile device is lost or temporarily borrowed by others, it is impossible to use the user's identity to log in to the mobile app, which improves the security of mobile app login.

结合第三方面,在一种可能的实现方式中,该方法还包括:在服务器根据公钥对第一签名结果进行验证之前,服务器验证第一签名结果在服务器不存在。With reference to the third aspect, in a possible implementation manner, the method further includes: before the server verifies the first signature result according to the public key, the server verifies that the first signature result does not exist on the server.

也就是说,将电子设备提交的签名结果作为防重放攻击的检查项,可以实现对重放攻击的有效检测。若在服务器检测到签名结果不存在,则认为不是重放攻击,这样既能保证准确性,又不需要引入额外的信息。That is to say, using the signature result submitted by the electronic device as a check item for preventing replay attacks can realize effective detection of replay attacks. If the server detects that the signature result does not exist, it is considered not to be a replay attack, which can ensure accuracy without introducing additional information.

结合第三方面,在一种可能的实现方式中,该方法还包括:服务器包括一个或多个布隆过滤器,一个布隆过滤器用于存储一个时间范围内的签名结果;第二登录请求还包括电子设备的本地时间戳;服务器验证第一签名结果在服务器不存在,包括:服务器根据第二登录请求中电子设备的本地时间戳获取一个或多个布隆过滤器中第一布隆过滤器;服务器验证第二登录请求中第一签名结果在第一布隆过滤器中不存在。With reference to the third aspect, in a possible implementation manner, the method further includes: the server includes one or more bloom filters, and one bloom filter is used to store the signature results within a time range; the second login request further includes: Including the local timestamp of the electronic device; the server verifies that the first signature result does not exist on the server, including: the server obtains the first Bloom filter in one or more Bloom filters according to the local timestamp of the electronic device in the second login request ; The server verifies that the first signature result in the second login request does not exist in the first bloom filter.

在一种可能的设计方式中,通过把设定的时间误差范围划分为多个时间片段,并在每个时间片段创建一个布隆过滤器,在该布隆过滤器中保存对应时间片段的签名结果。随着时间的变化,之前创建的布隆过滤器对应的时间片段就会超出设定的时间误差范围,删除超出设定的时间误差范围的布隆过滤器,可以解决布隆过滤器内信息无法删除的问题。这样,服务器仅需要保存最大时间误差范围内的签名结果,而且也只需要对某一个时间片段内的签名结果进行检查,既节省了服务器的存储空间,而且查询过程耗时较短,大大提升了检测效率。In a possible design method, by dividing the set time error range into multiple time segments, and creating a bloom filter in each time segment, the signature of the corresponding time segment is saved in the bloom filter result. As time changes, the time segment corresponding to the previously created Bloom filter will exceed the set time error range. Deleting the Bloom filter that exceeds the set time error range can solve the problem that the information in the Bloom filter cannot be Deleted question. In this way, the server only needs to save the signature results within the maximum time error range, and only needs to check the signature results in a certain time segment, which not only saves the storage space of the server, but also takes less time for the query process, which greatly improves the detection efficiency.

结合第三方面,在一种可能的实现方式中,该方法还包括:在根据第二登录请求中电子设备的本地时间戳获取一个或多个布隆过滤器中第一布隆过滤器之前,服务器确定第二登录请求中电子设备的本地时间戳与服务器的当前时间之间的差值小于设定的时间误差范围。这样,不需要额外的网络交互就能实现用户登录。同时,还可以过滤掉不在时间误差范围内的登录请求,缩小重放攻击的检测范围。With reference to the third aspect, in a possible implementation manner, the method further includes: before acquiring the first bloom filter in the one or more bloom filters according to the local timestamp of the electronic device in the second login request, The server determines that the difference between the local timestamp of the electronic device in the second login request and the current time of the server is less than a set time error range. In this way, user login can be achieved without additional network interaction. At the same time, it can also filter out login requests that are not within the time error range, reducing the detection range of replay attacks.

结合第三方面,在一种可能的实现方式中,该方法还包括:如果第二登录请求中电子设备的本地时间戳与服务器的当前时间之间的差值大于或等于设定的时间误差范围,服务器向电子设备发送服务器的当前时间。电子设备从服务器接收服务器的当前时间;电子设备向服务器发送第三登录请求,第三登录请求包括服务器的当前时间,第二签名结果和自动登录凭据;第二签名结果是采用私钥对服务器的当前时间进行签名生成的。With reference to the third aspect, in a possible implementation manner, the method further includes: if the difference between the local timestamp of the electronic device in the second login request and the current time of the server is greater than or equal to a set time error range , the server sends the current time of the server to the electronic device. The electronic device receives the current time of the server from the server; the electronic device sends a third login request to the server, and the third login request includes the current time of the server, the second signature result and the automatic login credentials; the second signature result is a private key to the server. The signature is generated at the current time.

结合第三方面,在一种可能的实现方式中,该方法还包括:如果第二登录请求中电子设备的本地时间戳与服务器的当前时间之间的差值大于或等于设定的时间误差范围,服务器向电子设备发送服务器的当前时间;电子设备从服务器接收服务器的当前时间;电子设备向服务器发送第三登录请求,第三登录请求包括服务器的当前时间,第二签名结果和自动登录凭据;第二签名结果是采用私钥对服务器的当前时间进行签名生成的。这样,可实现移动设备时间不准确情况下的容错处理。容错处理的登录流程和正常的登录流程相同,可以简化服务端程序的开发工作和空间占用。With reference to the third aspect, in a possible implementation manner, the method further includes: if the difference between the local timestamp of the electronic device in the second login request and the current time of the server is greater than or equal to a set time error range , the server sends the current time of the server to the electronic device; the electronic device receives the current time of the server from the server; the electronic device sends a third login request to the server, and the third login request includes the current time of the server, the second signature result and automatic login credentials; The second signature result is generated by using the private key to sign the current time of the server. In this way, fault-tolerant processing in the event that the time of the mobile device is inaccurate can be realized. The login process of fault-tolerant processing is the same as the normal login process, which can simplify the development work and space occupation of the server program.

第四方面,本申请提供一种电子设备,该电子设备可以实现上述第一方面及其可能的实现方式所述的应用运行方法,其可以通过软件、硬件、或者通过硬件执行相应的软件实现上述方法。在一种可能的设计中,该电子设备可以包括处理器和存储器。该处理器被配置为支持该电子设备执行上述第一方面方法中相应的功能。存储器用于与处理器耦合,其保存该电子设备必要的程序指令和数据。In a fourth aspect, the present application provides an electronic device, which can implement the application running method described in the first aspect and its possible implementation manners, and can implement the above-mentioned method through software, hardware, or executing corresponding software through hardware. method. In one possible design, the electronic device may include a processor and memory. The processor is configured to support the electronic device to perform the corresponding functions in the method of the first aspect. The memory is for coupling with the processor, which holds the necessary program instructions and data for the electronic device.

第五方面,本申请提供一种服务器,该服务器可以实现上述第二方面及其可能的实现方式所述的应用运行方法,其可以通过软件、硬件、或者通过硬件执行相应的软件实现上述方法。在一种可能的设计中,该服务器可以包括处理器和存储器。该处理器被配置为支持该服务器执行上述第二方面方法中相应的功能。存储器用于与处理器耦合,其保存该服务器必要的程序指令和数据。In a fifth aspect, the present application provides a server, which can implement the application running method described in the second aspect and its possible implementation manners, and can implement the above method through software, hardware, or executing corresponding software through hardware. In one possible design, the server may include a processor and memory. The processor is configured to support the server to perform the corresponding functions in the method of the second aspect. The memory is for coupling with the processor, which holds the necessary program instructions and data for the server.

第六方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当所述计算机指令在电子设备上运行时,使得电子设备执行如上述第一方面及其可能的实现方式所述的应用运行方法。In a sixth aspect, the present application provides a computer-readable storage medium, the computer-readable storage medium comprising computer instructions, when the computer instructions are executed on an electronic device, the electronic device is made to perform the above-mentioned first aspect and its possible The application running method described in the implementation manner is implemented.

第七方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当所述计算机指令在服务器上运行时,使得服务器执行如上述第二方面及其可能的实现方式所述的应用运行方法。In a seventh aspect, the present application provides a computer-readable storage medium, where the computer-readable storage medium includes computer instructions, when the computer instructions are executed on a server, the server is made to execute the second aspect and possible implementations thereof. The described application running method.

附图说明Description of drawings

图1为现有技术移动中一种移动应用程序App登录方法示意图;1 is a schematic diagram of a mobile application App login method in the prior art mobile;

图2为本申请实施例提供的应用运行方法场景示意图;FIG. 2 is a schematic diagram of a scenario of an application running method provided by an embodiment of the present application;

图3为本申请实施例提供的电子设备的硬件结构示意图;3 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application;

图4为本申请实施例提供的移动App登录系统的软件架构;4 is a software architecture of a mobile App login system provided by an embodiment of the present application;

图5为本申请实施例提供的移动App登录流程切换场景的示意图;5 is a schematic diagram of a mobile App login process switching scenario provided by an embodiment of the present application;

图6为本申请实施例提供的移动App登录流程切换方法的示意图;6 is a schematic diagram of a mobile App login process switching method provided by an embodiment of the present application;

图7为本申请实施例提供的移动App手动登录方法的示意图;7 is a schematic diagram of a manual login method for a mobile App provided by an embodiment of the present application;

图8为本申请实施例提供的一种移动App用户登录界面的示意图;8 is a schematic diagram of a mobile App user login interface provided by an embodiment of the present application;

图9为本申请实施例提供的移动App自动登录方法的示意图;9 is a schematic diagram of an automatic login method for a mobile App provided by an embodiment of the present application;

图10为本申请实施例提供的布隆过滤器的示意图;10 is a schematic diagram of a Bloom filter provided by an embodiment of the application;

图11为本申请实施例提供的一种电子设备的结构组成示意图;FIG. 11 is a schematic structural diagram of an electronic device according to an embodiment of the application;

图12为本申请实施例提供的一种服务器的结构组成示意图。FIG. 12 is a schematic structural composition diagram of a server according to an embodiment of the present application.

具体实施方式Detailed ways

以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请以下各实施例中,“至少一个”、“一个或多个”是指一个或两个以上(包含两个)。术语“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。The terms used in the following embodiments are for the purpose of describing particular embodiments only, and are not intended to be limitations of the present application. As used in the specification of this application and the appended claims, the singular expressions "a," "an," "the," "above," "the," and "the" are intended to also Expressions such as "one or more" are included unless the context clearly dictates otherwise. It should also be understood that, in the following embodiments of the present application, "at least one" and "one or more" refer to one or more than two (including two). The term "and/or", used to describe the association relationship of related objects, indicates that there can be three kinds of relationships; for example, A and/or B, can indicate: A alone exists, A and B exist at the same time, and B exists alone, A and B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship.

在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。术语“连接”包括直接连接和间接连接,除非另外说明。References in this specification to "one embodiment" or "some embodiments" and the like mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically emphasized otherwise. The terms "including", "including", "having" and their variants mean "including but not limited to" unless specifically emphasized otherwise. The term "connected" includes both direct and indirect connections unless otherwise specified.

以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may expressly or implicitly include one or more of that feature.

在本申请实施例中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。In the embodiments of the present application, words such as "exemplarily" or "for example" are used to represent examples, illustrations or illustrations. Any embodiment or design described in the embodiments of the present application as "exemplarily" or "such as" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "such as" is intended to present the related concepts in a specific manner.

移动App通常分为服务端和客户端。在客户端输入用户名和登录密码后,将用户名和登录密码提交到服务端进行认证。认证通过后,通常将认证凭据保存在客户端设备中,以使得客户端和服务端在一定时间段内保持用户的登录状态。Mobile apps are usually divided into server and client. After the client enters the user name and login password, submit the user name and login password to the server for authentication. After the authentication is passed, the authentication credentials are usually stored in the client device, so that the client and the server keep the user's login state for a certain period of time.

在一些示例中,认证凭据是用户名和登录密码。客户端设备接收到用户输入的用户名和登录密码后,保存该用户名和登录密码,用于自动登录过程中,将用户名和登录密码提交到服务端进行认证,保持用户的登录状态。In some examples, the authentication credentials are username and login password. After receiving the user name and login password entered by the user, the client device saves the user name and login password, and is used for submitting the user name and login password to the server for authentication during the automatic login process, so as to maintain the user's login status.

在另一些示例中,认证凭据是令牌。客户端设备将用户名和登录密码提交到服务端设备,服务端对用户名和登录密码进行加密生成一个令牌,并将生成的令牌发送到客户端进行保存。当再次登录移动App时,客户端将令牌提交到服务端进行认证。In other examples, the authentication credential is a token. The client device submits the user name and login password to the server device, and the server encrypts the user name and login password to generate a token, and sends the generated token to the client for storage. When logging into the mobile app again, the client submits the token to the server for authentication.

在另一些示例中,认证凭据是会话标识。示例性的,如图1所示,移动App的客户端运行在移动设备的操作系统中,移动App的服务端运行在服务器上。用户在移动App客户端输入用户名以及登录密码;移动设备将用户名以及登录密码提交到服务器进行身份认证。移动App服务端的身份认证模块对接收到的用户名和登录密码进行认证;认证通过后,向移动设备返回会话标识。移动设备存储该会话标识,会话标识为移动App的客户端与服务端之间传输数据的凭证。移动App客户端每次访问服务器时,都在请求中携带会话标识。服务端可根据会话标识查找用户名以及登录状态,查找到上述信息后,则获得用户名,用户处于登录状态。In other examples, the authentication credential is a session ID. Exemplarily, as shown in FIG. 1 , the client of the mobile App runs on the operating system of the mobile device, and the server of the mobile App runs on the server. The user enters the user name and login password on the mobile App client; the mobile device submits the user name and login password to the server for authentication. The identity authentication module of the mobile App server authenticates the received user name and login password; after the authentication is passed, the session identifier is returned to the mobile device. The mobile device stores the session identifier, and the session identifier is the credential for data transmission between the client and the server of the mobile App. Every time the mobile App client accesses the server, it carries the session identifier in the request. The server can look up the user name and the login status according to the session ID. After finding the above information, the user name is obtained and the user is in the login status.

为了避免用户频繁输入用户名和登录密码,在客户端设备保存认证凭据的有效期通常被设置为较长时间。客户端设备保存认证凭据的存储空间为富执行环境(richexecution environment,REE)。REE被入侵的风险较大,认证凭据容易被泄漏。如此一来,移动App登录过程的安全性便无法得到保障,可能发生其他设备仿冒用户进行登录,给用户造成损失。In order to prevent users from frequently entering user names and login passwords, the validity period of the authentication credentials stored in the client device is usually set to a longer period of time. The storage space in which the client device stores the authentication credentials is a rich execution environment (REE). The risk of REE being hacked is high, and the authentication credentials are easily leaked. As a result, the security of the mobile app login process cannot be guaranteed, and other devices may imitate the user to log in, causing losses to the user.

本申请实施例提供一种移动App登录方法、移动设备及系统。移动设备具备可信执行环境(trusted execution environment,TEE),TEE是一个小型的操作系统,它与REE之间相互独立。TEE可用于生成密钥,且生成的密钥无法被导出。因此,在TEE中生成的密钥具备防止被窃取的能力。本申请实施例提供的移动App登录方法,包括手动登录流程和自动登录流程。手动登录流程在用户首次登录移动App或者退出登录移动App后再次登录时执行,自动登录流程在用户手动登录移动App后至退出登录之前,用户每次打开移动App时执行。手动登录时调用TEE生成自动登录密钥对,用于自动登录时进行用户身份认证。在TEE中生成的自动登录密钥对不可导出,从而利用密钥对的不可导出能力防止认证凭据被窃取。如此一来,即使REE被入侵,只要TEE未被攻破,用户的身份信息也无法被窃取,从而降低了认证凭据被泄露的风险,增强了移动App登录过程安全性,提升用户体验。Embodiments of the present application provide a mobile App login method, mobile device, and system. The mobile device has a trusted execution environment (TEE), and the TEE is a small operating system that is independent of the REE. TEE can be used to generate keys, and the generated keys cannot be exported. Therefore, the key generated in the TEE has the ability to prevent theft. The mobile App login method provided by the embodiment of the present application includes a manual login process and an automatic login process. The manual login process is executed when the user logs in to the mobile app for the first time or logs in again after logging out of the mobile app. The automatic login process is executed every time the user opens the mobile app after the user manually logs in to the mobile app and before logging out. During manual login, TEE is called to generate an automatic login key pair, which is used for user authentication during automatic login. The auto-login key pair generated in the TEE is not exportable, thus preventing authentication credentials from being stolen by utilizing the non-exportability of the key pair. In this way, even if the REE is compromised, as long as the TEE is not compromised, the user's identity information cannot be stolen, thereby reducing the risk of leakage of authentication credentials, enhancing the security of the mobile app login process, and improving the user experience.

图2为本申请实施例提供的移动App登录系统的示意图。如图2所示,该系统至少可以包括:移动设备100和服务器200。移动设备100包括REE 10和TEE 20。移动App的客户端运行在REE 10内;比如,该REE 10可以是

Figure BDA0002999642400000073
等。TEE 20用于生成在自动登录过程中用于对客户端的身份进行认证的自动登录密钥对。REE 10和TEE 20相互独立。服务器200用于对客户端的身份进行认证,以实现移动App的登录。FIG. 2 is a schematic diagram of a mobile App login system provided by an embodiment of the present application. As shown in FIG. 2 , the system may at least include: a mobile device 100 and a server 200 . Mobile device 100 includes REE 10 and TEE 20 . The client of the mobile app runs in REE 10; for example, the REE 10 can be
Figure BDA0002999642400000073
Wait. The TEE 20 is used to generate an automatic login key pair for authenticating the identity of the client during the automatic login process. REE 10 and TEE 20 are independent of each other. The server 200 is used to authenticate the identity of the client, so as to realize the login of the mobile App.

上述移动设备100可以是包括TEE的电子设备,该电子设备包括便携式移动通信设备(如手机等)、手持计算机、平板电脑、笔记本电脑、上网本、个人电脑(personalcomputer,PC)、智能家居设备(比如,智能电视、智慧屏、大屏等)、个人数字助理(personaldigital assistant,PDA)、可穿戴电子设备(如智能手表)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、车载电脑等。移动设备的示例性实施例包括但不限于搭载

Figure BDA0002999642400000071
Figure BDA0002999642400000072
Windows、Linux或者其它操作系统的便携式移动设备。上述移动设备也可为其它便携式移动设备,诸如膝上型计算机(Laptop)等。还应当理解的是,在其他一些实施例中,上述移动设备也可以不是便携式移动设备,而是台式计算机。需要说明的是,上述移动设备100还可以是其他具备防止密钥被窃取能力的电子设备;比如,具备可信赖平台模块(trusted platform module,TPM)等安全芯片的PC等,TPM用于生成和保存自动登录密钥对。以下实施例对该移动设备100的具体形式不做特殊限制。The above-mentioned mobile device 100 may be an electronic device including a TEE, and the electronic device includes a portable mobile communication device (such as a mobile phone, etc.), a handheld computer, a tablet computer, a notebook computer, a netbook, a personal computer (personal computer, PC), a smart home device (such as , smart TV, smart screen, large screen, etc.), personal digital assistant (PDA), wearable electronic devices (such as smart watches), augmented reality (AR) \ virtual reality (virtual reality, VR) devices , car computer, etc. Exemplary embodiments of mobile devices include, but are not limited to, piggybacks
Figure BDA0002999642400000071
Figure BDA0002999642400000072
Portable mobile devices for Windows, Linux or other operating systems. The above-mentioned mobile device may also be other portable mobile devices, such as a laptop computer (Laptop) or the like. It should also be understood that, in other embodiments, the above-mentioned mobile device may not be a portable mobile device, but a desktop computer. It should be noted that the above-mentioned mobile device 100 may also be other electronic devices capable of preventing key theft; for example, a PC with a security chip such as a trusted platform module (TPM), etc. Save the auto-login key pair. The following embodiments do not specifically limit the specific form of the mobile device 100 .

示例性的,请参考图3,其示出了一种移动设备100的结构示意图。移动设备100可包括处理器110,外部存储器接口120,内部存储器121,音频模块130,扬声器130A,麦克风130B,显示屏140,移动通信模块150,无线通信模块155,摄像头160,SIM卡接口170,指纹传感器180,触摸传感器185,电源模块190等。Exemplarily, please refer to FIG. 3 , which shows a schematic structural diagram of a mobile device 100 . The mobile device 100 may include a processor 110, an external memory interface 120, an internal memory 121, an audio module 130, a speaker 130A, a microphone 130B, a display screen 140, a mobile communication module 150, a wireless communication module 155, a camera 160, a SIM card interface 170, Fingerprint sensor 180, touch sensor 185, power module 190, etc.

可以理解的是,本申请实施例示意的结构并不构成对移动设备100的具体限定。在本申请另一些实施例中,移动设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以为硬件,软件或软件和硬件的组合实现。It can be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the mobile device 100 . In other embodiments of the present application, the mobile device 100 may include more or less components than shown, or some components may be combined, or some components may be split, or different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

处理器110可以包括一个或多个处理单元。例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),和/或神经网络处理器(neural-networkprocessing unit,NPU)等。其中,不同的处理单元可以是独立的部件,也可以集成在一个或多个处理器中。在一些实施例中,移动设备100也可以包括一个或多个处理器110。Processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (ISP), a controller, a video encoder A decoder, a digital signal processor (DSP), and/or a neural-network processing unit (NPU), etc. Wherein, different processing units may be independent components, or may be integrated in one or more processors. In some embodiments, mobile device 100 may also include one or more processors 110 .

其中,控制器是移动设备100的神经中枢和指挥中心。可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller is the nerve center and command center of the mobile device 100 . The operation control signal can be generated according to the instruction operation code and the timing signal to complete the control of fetching and executing the instruction.

应用处理器上可以运行移动设备100的操作系统,用于管理移动设备100的硬件与软件资源。比如,管理与配置内存、决定系统资源供需的优先次序、控制输入与输出设备、操作网络、管理文件系统、管理驱动程序等。操作系统也可以用于提供一个让用户与系统交互的操作界面。其中,操作系统内可以安装各类软件,比如,驱动程序,应用程序(application,App)等。The operating system of the mobile device 100 can be run on the application processor to manage the hardware and software resources of the mobile device 100 . For example, managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating networks, managing file systems, managing drivers, etc. The operating system can also be used to provide an operating interface for the user to interact with the system. Wherein, various types of software can be installed in the operating system, for example, a driver program, an application program (application, App), and the like.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路间(inter-integrated circuit,I2C)接口,集成电路间音频(integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,SIM卡接口,和/或USB接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input/output (general-purpose input/output, GPIO) interface, SIM card interface, and/or USB interface, etc.

可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对移动设备100的结构限定。在本申请另一些实施例中,移动设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the mobile device 100 . In other embodiments of the present application, the mobile device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.

外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展移动设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile device 100 . The external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.

内部存储器121可以用于存储一个或多个计算机程序,该一个或多个计算机程序包括指令。处理器110可以通过运行存储在内部存储器121的上述指令,从而使得移动设备100执行本申请一些实施例中所提供的应用运行方法,以及各种应用以及数据管理等。内部存储器121可以包括代码存储区和数据存储区。其中,数据存储区可存储移动设备100使用过程中所创建的数据等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如一个或多个磁盘存储部件,闪存部件,通用闪存存储器(universalflash storage,UFS)等。在一些实施例中,处理器110可以通过运行存储在内部存储器121的指令,和/或存储在设置于处理器110中的存储器的指令,来使得移动设备100执行本申请实施例中所提供的应用运行方法,以及其他应用及数据管理。Internal memory 121 may be used to store one or more computer programs including instructions. The processor 110 may execute the above-mentioned instructions stored in the internal memory 121, thereby causing the mobile device 100 to execute the application running methods, various applications and data management provided in some embodiments of the present application. The internal memory 121 may include a code storage area and a data storage area. The data storage area may store data and the like created during the use of the mobile device 100 . In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), and the like. In some embodiments, the processor 110 may cause the mobile device 100 to execute the instructions provided in the embodiments of the present application by executing the instructions stored in the internal memory 121 and/or the instructions stored in the memory provided in the processor 110 Application run method, and other application and data management.

移动设备100可以通过音频模块130,扬声器130A,麦克风130B,以及应用处理器等实现音频功能。例如音乐播放,录音等。音频模块130用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块130还可以用于对音频信号编码和解码。在一些实施例中,音频模块130可以设置于处理器110中,或将音频模块130的部分功能模块设置于处理器110中。The mobile device 100 may implement audio functions through an audio module 130, a speaker 130A, a microphone 130B, an application processor, and the like. Such as music playback, recording, etc. The audio module 130 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 130 may also be used to encode and decode audio signals. In some embodiments, the audio module 130 may be provided in the processor 110 , or some functional modules of the audio module 130 may be provided in the processor 110 .

扬声器130A,也称“喇叭”,用于将音频电信号转换为声音信号。Speaker 130A, also referred to as a "speaker", is used to convert audio electrical signals into sound signals.

麦克风130B,也称“话筒”,“传声器”,用于将声音信号转换为电信号。用户可以通过人嘴靠近麦克风130B发声,将声音信号输入到麦克风130B。The microphone 130B, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. The user can make a sound by approaching the microphone 130B through the human mouth, and input the sound signal to the microphone 130B.

移动设备100的无线通信功能可以通过天线以及移动通信模块150等实现。The wireless communication function of the mobile device 100 may be implemented by an antenna, a mobile communication module 150 and the like.

移动通信模块150可以提供应用在移动设备100上的包括Wi-Fi,蓝牙(bluetooth,BT),无线数传模块(例如,433MHz,868MHz,915MHz)等无线通信的解决方案。移动通信模块150可以是集成至少一个通信处理模块的一个或多个器件。移动通信模块150经由天线1接收电磁波,将电磁波信号滤波以及调频处理,将处理后的信号发送到处理器110。移动通信模块150还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线1转为电磁波辐射出去。The mobile communication module 150 may provide wireless communication solutions applied on the mobile device 100 including Wi-Fi, Bluetooth (BT), and wireless data transmission modules (eg, 433MHz, 868MHz, 915MHz). The mobile communication module 150 may be one or more devices integrating at least one communication processing module. The mobile communication module 150 receives electromagnetic waves via the antenna 1 , filters and frequency modulates the electromagnetic wave signals, and sends the processed signals to the processor 110 . The mobile communication module 150 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify the signal, and then convert it into electromagnetic waves for radiation through the antenna 1 .

无线通信模块155可以提供应用在移动设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块155可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块155经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块155还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 155 can provide applications on the mobile device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 155 may be one or more devices integrating at least one communication processing module. The wireless communication module 155 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 155 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify the signal, and then convert it into electromagnetic waves for radiation through the antenna 2 .

在一些实施例中,移动设备100的天线1和移动通信模块150耦合,天线2和无线通信模块155耦合,使得移动设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(codedivision multiple access,CDMA),宽带码分多址(wideband code division multipleaccess,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidounavigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellitesystem,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the mobile device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 155, so that the mobile device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code Wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM , and/or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou satellite navigation system (BDS), a quasi-zenith satellite system (quasi- zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).

移动设备100通过GPU,显示屏140,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏140和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The mobile device 100 implements a display function through a GPU, a display screen 140, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 140 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.

显示屏140用于显示图像,视频等。显示屏140包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,移动设备100可以包括1个或N个显示屏140,N为大于1的正整数。本申请实施例中,显示屏140可以用于显示用户登录界面,以及接收用户在用户登录界面输入的用户名和登录密码。The display screen 140 is used to display images, videos, and the like. The display screen 140 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode). , AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (quantum dot light emitting diodes, QLED) and so on. In some embodiments, the mobile device 100 may include 1 or N display screens 140 , where N is a positive integer greater than 1. In this embodiment of the present application, the display screen 140 may be used to display a user login interface, and receive a user name and a login password entered by the user on the user login interface.

指纹传感器180用于采集指纹。移动设备100可以利用采集的指纹特性进行指纹识别,实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180 is used to collect fingerprints. The mobile device 100 can use the collected fingerprint characteristics to perform fingerprint identification, realize fingerprint unlocking, access application locks, take photos with fingerprints, answer incoming calls with fingerprints, and the like.

触摸传感器185,也称“触控面板”。触摸传感器185可以设置于显示屏140,由触摸传感器185与显示屏140组成触摸屏,也称“触控屏”。触摸传感器185用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏140提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器185也可以设置于移动设备100的表面,与显示屏140所处的位置不同。The touch sensor 185 is also referred to as a "touch panel". The touch sensor 185 may be disposed on the display screen 140 , and the touch sensor 185 and the display screen 140 form a touch screen, also referred to as a “touch screen”. The touch sensor 185 is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to touch operations may be provided through display screen 140 . In other embodiments, the touch sensor 185 may also be disposed on the surface of the mobile device 100 at a different location than the display screen 140 .

SIM卡接口170用于连接SIM卡。SIM卡可以通过插入SIM卡接口170,或从SIM卡接口170拔出,实现和移动设备100的接触和分离。SIM卡接口170可以支持Nano SIM卡,MicroSIM卡,SIM卡等。同一个SIM卡接口170可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口170也可以兼容不同类型的SIM卡。SIM卡接口170也可以兼容外部存储卡。移动设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,移动设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在移动设备100中,不能和移动设备100分离。The SIM card interface 170 is used to connect a SIM card. The SIM card can be contacted and separated from the mobile device 100 by inserting into the SIM card interface 170 or pulling out from the SIM card interface 170 . The SIM card interface 170 can support Nano SIM cards, Micro SIM cards, SIM cards and the like. Multiple cards can be inserted into the same SIM card interface 170 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 170 can also be compatible with different types of SIM cards. The SIM card interface 170 may also be compatible with external memory cards. The mobile device 100 interacts with the network through the SIM card to implement functions such as call and data communication. In some embodiments, the mobile device 100 employs an eSIM, ie: an embedded SIM card. The eSIM card can be embedded in the mobile device 100 and cannot be separated from the mobile device 100 .

摄像头160用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,移动设备100可以包括1个或N个摄像头160,N为大于1的正整数。本申请实施例中,摄像头160可以用于采集用户面部图像,用于面部识别,虹膜识别等。Camera 160 is used to capture still images or video. The object is projected through the lens to generate an optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In some embodiments, the mobile device 100 may include 1 or N cameras 160 , where N is a positive integer greater than 1. In this embodiment of the present application, the camera 160 may be used to collect a user's facial image for facial recognition, iris recognition, and the like.

电源模块185,可以用于向移动设备100包含的各个部件供电。在一些实施例中,该电源模块185可以是电池,如可充电电池。The power module 185 can be used to supply power to various components included in the mobile device 100 . In some embodiments, the power module 185 may be a battery, such as a rechargeable battery.

本申请实施例提供的移动App登录系统的软件架构如图4所示。The software architecture of the mobile App login system provided by the embodiment of the present application is shown in FIG. 4 .

移动设备100包括REE 10和TEE 20,这两个操作系统之间相互隔离;REE 10可以通过命令调用TEE 20,不能直接控制TEE 20;即使REE 10被入侵,也不会直接导致TEE 20的安全性遭到破坏。移动App的客户端1010运行在REE 10中。移动App客户端1010包括手动登录模块1011和公钥自动登录模块1012。手动登录模块1011,用于在用户手动登录(用户首次登录移动App或者退出登录移动App后再次登录)时,在移动设备100的显示屏上显示用户登录界面;接收用户在用户登录界面输入的用户名和登录密码;还用于在手动登录过程中向服务器提交用于认证的信息。公钥自动登录模块1012用于在自动登录过程中向服务器200提交用于认证的信息。REE 10还包括本地存储1020和密钥管理功能1030。本地存储1020用于存储用户名和自动登录凭据等。密钥管理功能1030用于调用TEE 20生成自动登录密钥对。TEE 20用于生成和保存自动登录密钥对。The mobile device 100 includes the REE 10 and the TEE 20, and the two operating systems are isolated from each other; the REE 10 can call the TEE 20 through commands and cannot directly control the TEE 20; even if the REE 10 is invaded, it will not directly lead to the security of the TEE 20 Sexuality is destroyed. The client 1010 of the mobile app runs in the REE 10. The mobile App client 1010 includes a manual login module 1011 and a public key automatic login module 1012 . The manual login module 1011 is used to display the user login interface on the display screen of the mobile device 100 when the user manually logs in (the user logs in to the mobile App for the first time or logs in again after logging out of the mobile App); name and login password; also used to submit information to the server for authentication during manual login. The public key automatic login module 1012 is used to submit information for authentication to the server 200 during the automatic login process. The REE 10 also includes local storage 1020 and key management functions 1030. Local storage 1020 is used to store usernames and automatic login credentials, among others. The key management function 1030 is used to invoke the TEE 20 to generate an automatic login key pair. TEE 20 is used to generate and save automatic login key pairs.

移动App的服务端2010运行在服务器200中,服务端2010包括手动登录处理模块2011、自动登录处理模块2012以及密钥模块2013。手动登录处理模块2011用于手动登录过程中的身份认证;还用于调用密钥模块2013对手动登录过程中移动设备100提交的信息进行加密,生成自动登录凭据。自动登录处理模块2012用于调用密钥模块2013对自动登录过程中移动设备100提交的信息进行解密,并根据移动设备100提交的信息进行身份认证。The server 2010 of the mobile App runs in the server 200 , and the server 2010 includes a manual login processing module 2011 , an automatic login processing module 2012 and a key module 2013 . The manual login processing module 2011 is used for identity authentication in the manual login process; it is also used for invoking the key module 2013 to encrypt the information submitted by the mobile device 100 in the manual login process to generate automatic login credentials. The automatic login processing module 2012 is configured to call the key module 2013 to decrypt the information submitted by the mobile device 100 during the automatic login process, and perform identity authentication according to the information submitted by the mobile device 100 .

下面结合附图对本申请实施例提供的移动App登录方法进行详细介绍。The mobile App login method provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

示例性的,如图5所示,移动App客户端在移动设备上安装完成后,用户首次登录移动App或者退出登录移动App后再次登录,执行手动登录流程。用户手动登录移动App后至退出登录之前,用户每次打开移动App时,执行自动登录流程;这样,避免了用户每次登录都手动输入用户名和密码。Exemplarily, as shown in FIG. 5 , after the mobile App client is installed on the mobile device, the user logs in to the mobile App for the first time or logs in again after logging out of the mobile App, and performs a manual login process. After the user manually logs in to the mobile app and before logging out, each time the user opens the mobile app, an automatic login process is performed; in this way, the user is prevented from manually entering the user name and password each time he logs in.

移动设备每次检测到移动App被打开,确定执行手动登录流程或执行自动登录流程。在一种示例中,如图6所示,移动设备确定执行手动登录流程或执行自动登录流程的方法包括:Every time the mobile device detects that the mobile App is opened, it determines to execute the manual login process or the automatic login process. In an example, as shown in FIG. 6 , the method for the mobile device to determine to perform a manual login process or to perform an automatic login process includes:

S101、移动App客户端确定密钥管理功能中是否存在自动登录密钥对。S101. The mobile App client determines whether an automatic login key pair exists in the key management function.

自动登录密钥对用于在手动登录流程中与用户名等用户的身份信息进行绑定。移动App客户端每次启动,确定密钥管理功能中是否存在自动登录密钥对;如果确定自动登录密钥对不存在,执行S102,密钥管理功能获取自动登录密钥对;如果确定自动登录密钥对存在,执行S103,确定本地存储中是否存在自动登录凭据。The automatic login key pair is used to bind the user's identity information such as username in the manual login process. Each time the mobile App client is started, determine whether there is an automatic login key pair in the key management function; if it is determined that the automatic login key pair does not exist, perform S102, and the key management function obtains the automatic login key pair; if it is determined that the automatic login key pair If the key pair exists, go to S103 to determine whether there is an automatic login credential in the local storage.

S102、密钥管理功能获取自动登录密钥对。S102, the key management function acquires an automatic login key pair.

用户首次登录移动App或者退出登录移动App后再次登录时,密钥管理功能中并不存在自动登录密钥对。密钥管理功能模块调用TEE生成自动登录密钥对,生成的自动登录密钥对在TEE中保存,且整个生命周期内都不会离开TEE。由于TEE不容易受到黑客攻击,且生成的自动登录密钥对也无法被导出。这样,自动登录密钥对不容易被窃取。When a user logs in to the mobile app for the first time or logs in again after logging out of the mobile app, there is no automatic login key pair in the key management function. The key management function module calls the TEE to generate an automatic login key pair. The generated automatic login key pair is stored in the TEE and will not leave the TEE during the entire life cycle. Since TEE is not easily attacked by hackers, and the generated auto-login key pair cannot be exported. In this way, the automatic login key pair is not easily stolen.

在一种实现方式中,自动登录密钥对为非对称密钥,由公钥和私钥组成,公钥和私钥之间配对使用,私钥用于签名,公钥用于验证私钥的签名。可以理解的,自动登录密钥对也可以为对称密钥,本申请实施例对此并不进行限定。In one implementation, the automatic login key pair is an asymmetric key, which consists of a public key and a private key. The public key and the private key are paired and used, the private key is used for signature, and the public key is used to verify the signature of the private key. sign. It can be understood that the automatic login key pair may also be a symmetric key, which is not limited in this embodiment of the present application.

在一种实现方式中,生成自动登录密钥对时可以指定每次使用私钥前是否需要验证用户的生物特征。验证用户的生物特征包括指纹识别,面部识别,虹膜识别等。如果每次使用私钥前需要验证用户的生物特征(比如,在自动登录过程中使用自动登录密钥对的私钥对时间戳签名前对用户的指纹信息进行验证),在每次登录移动App过程中均可验证用户身份,即使移动设备丢失或被其他人临时借用,也无法冒用用户身份登录移动App,提高了移动App登录安全性。In one implementation, when the automatic login key pair is generated, it can be specified whether the user's biometrics needs to be verified before each use of the private key. Authenticating user's biometrics includes fingerprint recognition, facial recognition, iris recognition, etc. If the user's biometrics needs to be verified before each use of the private key (for example, the user's fingerprint information is verified before the timestamp is signed using the private key of the automatic login key pair during the automatic login process), every time you log in to the mobile app During the process, the user's identity can be verified. Even if the mobile device is lost or temporarily borrowed by others, it is impossible to use the user's identity to log in to the mobile app, which improves the security of mobile app login.

TEE生成自动登录密钥对会消耗一定时间,在移动App客户端启动时生成自动登录密钥对不占用登录过程时间,可以避免登录过程有时延影响用户体验。需要说明的是,在另一些实施例中,也可以在登录过程中生成自动登录密钥对,其并不影响本申请实施例提供的移动App登录方法执行正确性。It takes a certain amount of time for the TEE to generate an automatic login key pair. The automatic login key pair generated when the mobile App client starts does not occupy the login process time, which can avoid the delay in the login process and affect the user experience. It should be noted that, in other embodiments, an automatic login key pair may also be generated during the login process, which does not affect the execution correctness of the mobile App login method provided by the embodiments of the present application.

S103、移动App客户端确定本地存储中是否存在自动登录凭据。若确定本地存储中不存在自动登录凭据,执行手动登录流程;若确定本地存储中存在自动登录凭据,执行自动登录流程。S103, the mobile App client determines whether there is an automatic login credential in the local storage. If it is determined that the automatic login credentials do not exist in the local storage, the manual login process is performed; if it is determined that the automatic login credentials exist in the local storage, the automatic login process is performed.

手动登录过程中,移动App服务端的密钥模块对用户名以及自动登录密钥对的公钥进行加密生成自动登录凭据,将生成的自动登录凭据保存在移动设备的本地存储中。在另一种实现方式中,移动App服务端的密钥模块也可以对用户名、登录密码和自动登录密钥对的公钥进行加密生成自动登录凭据,将生成的自动登录凭据保存在移动设备的本地存储中。移动App确定本地存储中是否存在自动登录凭据,若确定本地存储中不存在自动登录凭据,表明未执行过手动登录流程或已退出登录移动App,则执行手动登录流程;若确定本地存储中存在自动登录凭据,执行自动登录流程。During the manual login process, the key module of the mobile app server encrypts the user name and the public key of the automatic login key pair to generate automatic login credentials, and saves the generated automatic login credentials in the local storage of the mobile device. In another implementation manner, the key module of the mobile App server can also encrypt the user name, login password and the public key of the automatic login key pair to generate automatic login credentials, and save the generated automatic login credentials in the mobile device's in local storage. The mobile app determines whether there is an automatic login credential in the local storage. If it is determined that there is no automatic login credential in the local storage, it indicates that the manual login process has not been performed or the mobile app has been logged out, and the manual login process is performed; if it is determined that there is an automatic login credential in the local storage. Login credentials to perform an automatic login process.

如图7所示,本申请实施例提供的移动App手动登录流程包括:As shown in FIG. 7 , the manual login process of the mobile App provided by the embodiment of the present application includes:

S201、客户端获取用户名和登录密码。S201, the client obtains a user name and a login password.

移动设备显示移动App的用户登录界面。用户可以在该用户登录界面上输入用户名以及登录密码。示例性的,图8示出了移动App用户登录界面的一种示例。以手机作为移动设备为例,手机800显示移动App用户登录界面810,用户登录界面810包括“用户名”输入框811、“密码”输入框812以及“确定”按钮813。用户可以在“用户名”输入框811输入用户名称,在“密码”输入框812中输入与用户名对应的登录密码。用户可以点击“确定”按钮813,进行登录。The mobile device displays the user login interface of the mobile app. The user can enter a user name and a login password on the user login interface. Exemplarily, FIG. 8 shows an example of a mobile App user login interface. Taking a mobile phone as a mobile device as an example, the mobile phone 800 displays a mobile App user login interface 810 . The user can input a user name in the “Username” input box 811 , and input a login password corresponding to the user name in the “Password” input box 812 . The user can click the "OK" button 813 to log in.

移动设备接收用户输入的用户名和登录密码,移动App客户端获取用户名和登录密码。The mobile device receives the user name and login password entered by the user, and the mobile App client obtains the user name and login password.

S202、客户端调用密钥管理功能获取自动登录密钥对的公钥。S202, the client invokes the key management function to obtain the public key of the automatic login key pair.

移动App客户端调用密钥管理功能的接口从TEE获取自动登录密钥对的公钥。The mobile App client invokes the API of the key management function to obtain the public key of the automatic login key pair from the TEE.

S203、客户端向服务端提交用户名、登录密码和自动登录密钥对的公钥。S203, the client submits the user name, the login password and the public key of the automatic login key pair to the server.

在一种实现方式中,客户端向服务端发送第一登录请求消息;第一登录请求用于请求登录移动App,其中包括用户名、登录密码和自动登录密钥对的公钥等信息。In an implementation manner, the client sends a first login request message to the server; the first login request is used to request to log in to the mobile App, which includes information such as a user name, a login password, and the public key of an automatic login key pair.

S204、服务端的手动登录处理模块接收用户名、登录密码和自动登录密钥对的公钥。手动登录处理模块对用户名和登录密码进行验证;如果验证不通过,执行S205,如果验证通过,执行S206。S204, the manual login processing module of the server receives the user name, the login password and the public key of the automatic login key pair. The manual login processing module verifies the user name and the login password; if the verification fails, execute S205; if the verification passes, execute S206.

在一种实现方式中,用户在该移动App注册用户账号时,服务器保存该用户账号的用户名和登录密码。手动登录处理模块接收到用户名和登录密码,根据保存的该移动App的用户名列表,确定接收到的用户名是否为授权的用户名;比如,确定接收到的用户名属于服务器保存的该移动App的用户名列表,确定接收到的用户名是授权的用户名。In an implementation manner, when a user registers a user account in the mobile App, the server saves the user name and login password of the user account. The manual login processing module receives the user name and login password, and determines whether the received user name is an authorized user name according to the stored user name list of the mobile App; for example, determines that the received user name belongs to the mobile App saved by the server A list of usernames to determine if the username received is an authorized username.

如果确定接收到的用户名是授权的用户名,手动登录处理模块比较接收到的登录密码与本地保存的该用户名对应的登录密码,如果确定接收到的登录密码与本地保存的该用户名对应的登录密码相同,验证通过;如果确定接收到的登录密码与本地保存的该用户名对应的登录密码不相同,验证不通过。If it is determined that the received user name is an authorized user name, the manual login processing module compares the received login password with the locally stored login password corresponding to the user name, and if it is determined that the received login password corresponds to the locally stored user name If it is determined that the received login password is not the same as the login password corresponding to the user name saved locally, the verification fails.

如果确定接收到的用户名不是授权的用户名,验证不通过。If it is determined that the received username is not an authorized username, the authentication fails.

S205、服务端的手动登录处理模块向客户端返回错误消息,跳转到S201。S205, the manual login processing module of the server returns an error message to the client, and jumps to S201.

示例性的,若用户在用户登录界面将用户名或登录密码输入错误,手动登录处理模块验证不通过。手动登录处理模块向移动App的客户端返回错误消息。客户端接收到该错误消息,显示用户登录界面,获取用户名和登录密码。Exemplarily, if the user inputs the username or the login password incorrectly on the user login interface, the manual login processing module fails the verification. The manual login processing module returns an error message to the client of the mobile app. The client receives the error message, displays the user login interface, and obtains the user name and login password.

S206、服务端的手动登录处理模块调用密钥模块对用户名和自动登录密钥对的公钥进行加密。S206, the manual login processing module of the server invokes the key module to encrypt the user name and the public key of the automatic login key pair.

S207、服务端的密钥模块对用户名和自动登录密钥对的公钥进行加密,生成自动登录凭据。S207, the key module of the server encrypts the user name and the public key of the automatic login key pair to generate automatic login credentials.

在一种实现方式中,密钥模块采用对称加密密钥进行加密;可选的,使用带额外认证数据的认证加密(authenticated encryption with associated data,AEAD)模式,如GCM(Galois/counter mode)、CCM(counter mode with CBC-MAC)模式。这样,可以同时保证被加密数据的机密性和完整性。在另一些实现方式中,密钥模块也可选择非对称加密密钥对用户名和自动登录密钥对的公钥进行加密和签名,以保证被加密数据的机密性和完整性。本申请实施例对此并不进行限定。In an implementation manner, the key module uses a symmetric encryption key for encryption; optionally, an authenticated encryption with associated data (AEAD) mode with additional authentication data, such as GCM (Galois/counter mode), CCM (counter mode with CBC-MAC) mode. In this way, the confidentiality and integrity of the encrypted data can be guaranteed at the same time. In other implementations, the key module may also select an asymmetric encryption key to encrypt and sign the user name and the public key of the automatic login key pair, so as to ensure the confidentiality and integrity of the encrypted data. This embodiment of the present application does not limit this.

密钥模块执行加密操作,生成自动登录凭据。这样,将用户名与自动登录密钥对进行了绑定,对自动登录密钥对进行认证,即为对用户身份信息的认证。由于自动登录密钥对是TEE生成和保存的,不容易泄露,安全性更高。The key module performs cryptographic operations and generates automatic login credentials. In this way, the user name and the automatic login key pair are bound, and the authentication of the automatic login key pair is the authentication of the user identity information. Since the automatic login key pair is generated and saved by TEE, it is not easy to be leaked, and the security is higher.

示例性的,密钥模块也可以对用户名、登录密码和自动登录密钥对的公钥进行加密,生成自动登录凭据,并在自动登录过程中对登录密码进行验证。这样,当用户发现自身账号存在风险并在当前设备修改移动App的登录密码后,由于在自动登录过程中需要对登录密码进行验证,可以避免其他保存了自动登录凭据的设备直接登录,使得其他设备上保存的自动登录凭据失效,能够进一步增加自动登陆过程的安全性。Exemplarily, the key module can also encrypt the user name, the login password and the public key of the automatic login key pair, generate the automatic login credentials, and verify the login password during the automatic login process. In this way, when the user finds that his account is at risk and modifies the login password of the mobile app on the current device, since the login password needs to be verified during the automatic login process, it can prevent other devices that have saved the automatic login credentials from directly logging in, making other devices The automatic login credentials saved on the system are invalid, which can further increase the security of the automatic login process.

S208、服务端的密钥模块将自动登录凭据发送给手动登录处理模块。S208, the key module of the server sends the automatic login credentials to the manual login processing module.

S209、服务端的手动登录处理模块接收到自动登录凭据,确定登录成功,创建会话。S209, the manual login processing module of the server receives the automatic login credentials, determines that the login is successful, and creates a session.

S210、服务端的手动登录处理模块将自动登录凭据以及会话标识返回移动App客户端。S210. The manual login processing module of the server returns the automatic login credentials and the session identifier to the mobile App client.

会话标识用于客户端和服务端之间传输数据的凭证。移动App客户端每次访问服务器时,都在请求中携带会话标识。服务端可根据会话标识查找用户名以及登录状态,查找到上述信息后,则获得用户名,使该用户账号处于登录状态。Session ID is used to transmit data between client and server. Every time the mobile App client accesses the server, it carries the session identifier in the request. The server can look up the user name and the login status according to the session ID, and after finding the above information, it will obtain the user name and make the user account in the login status.

S211、移动App客户端将自动登录凭据保存至本地存储。S211 , the mobile App client saves the automatic login credentials to the local storage.

移动App客户端接收到自动登录凭据,将自动登录凭据保存在本地存储中,用于自动登录流程中使用。The mobile App client receives the automatic login credentials, and saves the automatic login credentials in the local storage for use in the automatic login process.

本申请实施例中,手动登录和每次自动登录时都产生新的会话标识,会话标识的保存时间可以设置的较短;比如,会话标识只在用户登录移动App到关闭移动App的期间保存;会话标识保存的时间较短。这样,会话标识可以保存在移动设备的内存中;相对于较长时间得将会话标识保存在磁盘中,更安全。In the embodiment of the present application, a new session ID is generated during manual login and automatic login each time, and the storage time of the session ID can be set to be shorter; for example, the session ID is only saved during the period from when the user logs in to the mobile App to when the mobile App is closed; Session IDs are kept for a short period of time. In this way, the session ID can be stored in the memory of the mobile device; it is safer to save the session ID in the disk for a long time.

本申请实施例提供的移动App登录方法,手动登录过程中,将自动登录密钥对的公钥和用户名绑定在一起,生成自动登录凭据;在自动登录过程验证自动登录凭据。把对用户身份的认证转化为对自动登录密钥对的认证。由于自动登录密钥对是在TEE中生成和保存的,不容易被窃取,降低了认证凭据泄露风险。In the mobile App login method provided by the embodiment of the present application, during the manual login process, the public key of the automatic login key pair and the user name are bound together to generate the automatic login credentials; the automatic login credentials are verified during the automatic login process. Convert authentication of user identity to authentication of automatic login key pair. Since the automatic login key pair is generated and saved in the TEE, it is not easy to be stolen, which reduces the risk of authentication credential leakage.

为了避免用户每次打开移动App时都要输入用户名和登录密码,在移动App没有退出登录的情况下,用户每次打开移动App时,进行自动登录。In order to prevent the user from having to enter a user name and a login password every time the mobile app is opened, if the mobile app does not log out, the user will automatically log in every time the user opens the mobile app.

如图9所示,本申请实施例提供的移动App自动登录流程包括:As shown in FIG. 9 , the automatic login process of the mobile App provided by the embodiment of the present application includes:

S301、客户端获取本地时间戳。S301, the client obtains a local timestamp.

S302、客户端将本地时间戳发送给公钥自动登录模块。S302, the client sends the local timestamp to the public key automatic login module.

S303、客户端的公钥自动登录模块调用密钥管理功能,使用自动登录密钥对的私钥对本地时间戳进行签名,得到第一签名结果。S303, the public key automatic login module of the client invokes the key management function, and uses the private key of the automatic login key pair to sign the local time stamp to obtain a first signature result.

在一种实现方式中,如果在TEE生成自动登录密钥对时,指定每次使用私钥前需要验证用户的生物特征;公钥自动登录模块使用自动登录密钥对的私钥对本地时间戳进行签名前,验证用户的生物特征。比如,对用户进行指纹识别,面部识别,或虹膜识别等。In one implementation, if the TEE generates an automatic login key pair, it is specified that the user's biometrics needs to be verified before each use of the private key; the public key automatic login module uses the private key of the automatic login key pair to pair the local timestamp Verify the user's biometrics before signing. For example, fingerprint recognition, facial recognition, or iris recognition is performed on the user.

S304、客户端的公钥自动登录模块从本地存储中读取自动登录凭据。S304, the public key automatic login module of the client reads the automatic login credentials from the local storage.

S305、客户端的公钥自动登录模块向服务端提交本地时间戳、签名结果和自动登录凭据,进行自动登录。S305, the public key automatic login module of the client submits the local timestamp, the signature result and the automatic login credentials to the server to perform automatic login.

在一种实现方式中,客户端的公钥自动登录模块向服务端发送第二登录请求消息;第二登录请求消息用于请求登录移动App;其中包括第一签名结果、自动登录凭据和本地时间戳等信息。In an implementation manner, the public key automatic login module of the client sends a second login request message to the server; the second login request message is used to request to log in to the mobile App; which includes the first signature result, the automatic login credentials and the local timestamp and other information.

S306、服务端的自动登录处理模块验证客户端上报的本地时间戳是否在允许的时间范围内;若验证不通过,执行S307,若验证通过,执行S308。S306, the automatic login processing module of the server verifies whether the local timestamp reported by the client is within the allowable time range; if the verification fails, execute S307; if the verification passes, execute S308.

在移动App登录的过程中,会存在大量的重放攻击。重放攻击是指攻击者利用网络监听或其它方式盗取认证凭据,随后将认证凭据重新发送给认证服务器,以此来冒充用户身份进行登录的过程。本申请实施例提供的移动App登录方法中,对于移动App客户端提交的本地时间戳在允许的时间范围内的自动登录信息进行重放攻击检测;对于移动App客户端提交的本地时间戳不在允许的时间范围内的自动登录信息不进行重放攻击检测;通过验证移动App客户端提交的本地时间戳是否在允许的时间范围之内,缩小重放攻击的检测范围,提升登录效率。During the login process of the mobile app, there will be a large number of replay attacks. A replay attack refers to a process in which an attacker steals authentication credentials by using network monitoring or other methods, and then resends the authentication credentials to the authentication server, thereby impersonating the user's identity to log in. In the mobile App login method provided by the embodiment of the present application, replay attack detection is performed for automatic login information whose local timestamp submitted by the mobile App client is within the allowable time range; the local timestamp submitted by the mobile App client is not allowed Automatic login information within the specified time range will not be detected for replay attacks; by verifying whether the local timestamp submitted by the mobile app client is within the allowed time range, the detection range of replay attacks is narrowed and login efficiency is improved.

在一种实现方式中,服务端的自动登录处理模块比较接收到的客户端本地时间戳与服务器当前的时间,判断二者的差值是否在设定的时间误差范围之内。如果客户端本地时间戳与服务器当前时间的差值小于设定的时间误差范围,验证通过;如果客户端本地时间戳与服务器当前时间的差值大于或等于设定的时间误差范围,验证不通过。比如,设定的时间误差范围为3分钟,如果接收到的客户端本地时间戳为9:00,服务端的当前时间为9:05,自动登录处理模块确定客户端本地时间戳与服务器当前时间的差值大于设定的时间误差范围,移动App客户端提交的本地时间戳不在允许的时间范围之内,验证不通过;如果接收到的客户端本地时间戳为9:00,服务端的当前时间为9:02,自动登录处理模块确定客户端本地时间戳与服务器当前时间的差值小于设定的时间误差范围,移动App客户端提交的本地时间戳在允许的时间范围之内,验证通过。In an implementation manner, the automatic login processing module of the server compares the received local timestamp of the client with the current time of the server, and determines whether the difference between the two is within a set time error range. If the difference between the client's local timestamp and the server's current time is less than the set time error range, the verification is passed; if the difference between the client's local timestamp and the server's current time is greater than or equal to the set time error range, the verification fails . For example, the set time error range is 3 minutes. If the received local timestamp of the client is 9:00 and the current time of the server is 9:05, the automatic login processing module determines the difference between the local timestamp of the client and the current time of the server. If the difference is greater than the set time error range, the local time stamp submitted by the mobile app client is not within the allowed time range, and the verification fails; if the received local time stamp of the client is 9:00, the current time of the server is At 9:02, the automatic login processing module determines that the difference between the client's local timestamp and the server's current time is less than the set time error range, and the local timestamp submitted by the mobile App client is within the allowable time range, and the verification is passed.

需要说明的是,移动设备通常会开启网络校时功能,使移动设备本地时间准确。而网络延时会造成移动App客户端的本地时间戳与服务端当前时间之间存在误差,一般来说,网络延时产生的时间误差较小。在一种实现方式中,上述设定的时间误差范围大于网络中通常的最大网络延时(经验值)。在一些场景中,移动设备未开启网络校时功能,移动设备本地时间戳与服务端当前时间的时间误差较大。上述设定的时间误差范围大于正常移动App客户端与服务端的时间误差(经验值),即用户关闭网络校时功能时移动设备与服务端存在的时间偏差。It should be noted that the mobile device usually enables the network time calibration function to make the local time of the mobile device accurate. The network delay will cause an error between the local timestamp of the mobile app client and the current time of the server. Generally speaking, the time error caused by the network delay is small. In an implementation manner, the above set time error range is greater than the usual maximum network delay (an empirical value) in the network. In some scenarios, the network timing function is not enabled on the mobile device, and the time error between the local timestamp of the mobile device and the current time of the server is large. The time error range set above is larger than the time error (experience value) between the normal mobile App client and the server, that is, the time deviation between the mobile device and the server when the user turns off the network timing function.

设定的时间误差范围越大,移动App客户端对时间准确性的要求越不敏感。设定的时间误差范围值较大,即使移动设备本地时间不准确或存在网络延时,移动App也不需要额外的网络交互。另一方面,设定的时间误差范围值较小,可以缩小重放攻击的检测范围。这样,通过设置合适的设定的时间误差范围,可以提高登录效率。The larger the set time error range, the less sensitive the mobile App client is to the time accuracy requirements. The set time error range is relatively large. Even if the local time of the mobile device is inaccurate or there is a network delay, the mobile app does not require additional network interaction. On the other hand, the set time error range value is small, which can narrow the detection range of replay attacks. In this way, by setting an appropriate set time error range, the login efficiency can be improved.

S307、自动登录处理模块向移动App客户端返回服务端的当前时间,客户端将接收到的服务端当前时间作为本地时间戳,重新发起自动登录流程。S307. The automatic login processing module returns the current time of the server to the mobile App client, and the client uses the received current time of the server as a local timestamp, and re-initiates the automatic login process.

客户端本地时间戳与服务器当前时间的差值大于或等于设定的时间误差范围,服务端向客户端返回服务器的当前时间。客户端接收到服务端的当前时间,将服务端的当前时间作为本地时间戳,向服务器发送第三登录请求,第三登录请求包括服务器的当前时间,第二签名结果和自动登录凭据等信息。这样,移动App客户端再次提交自动登录请求,实现移动设备时间不准确情况下的容错处理。容错处理的自动登录流程和正常的自动登录流程相同,可以简化服务端程序的开发工作和空间占用。If the difference between the client's local timestamp and the server's current time is greater than or equal to the set time error range, the server returns the server's current time to the client. The client receives the current time of the server, uses the current time of the server as a local timestamp, and sends a third login request to the server. The third login request includes the current time of the server, the second signature result, and the automatic login credentials. In this way, the mobile App client submits the automatic login request again, so as to realize fault-tolerant processing when the time of the mobile device is inaccurate. The fault-tolerant automatic login process is the same as the normal automatic login process, which can simplify the development work and space occupation of the server program.

S308、服务端的自动登录处理模块根据签名结果检测是否存在重放攻击。如果确定存在重放攻击,执行S309,如果确定不存在重放攻击,执行S310。S308, the automatic login processing module of the server detects whether there is a replay attack according to the signature result. If it is determined that there is a replay attack, S309 is performed, and if it is determined that there is no replay attack, S310 is performed.

在一种实现方式中,自动登录处理模块使用基于时间片段的布隆过滤器序列检查签名结果是否已经使用过,以检测是否存在重放攻击。若确定签名结果在服务端已存在,则确定是重放攻击;若确定签名结果在服务端不存在,则确定不是重放攻击,将签名结果添加到移动App客户端当前时间戳对应的布隆过滤器内。In one implementation, the automatic login processing module checks whether the signature result has been used using a sequence of Bloom filters based on time slices to detect whether there is a replay attack. If it is determined that the signature result already exists on the server side, it is determined to be a replay attack; if it is determined that the signature result does not exist on the server side, it is determined that it is not a replay attack, and the signature result is added to the Bloom corresponding to the current timestamp of the mobile app client inside the filter.

将移动App客户端提交的签名结果作为防重放攻击的检查项,可以实现对重放攻击的有效检测。若在服务器检测到签名结果已经存在,则认为是重放攻击,这样既能保证准确性,又不需要引入额外的信息。The signature result submitted by the mobile app client is used as the check item for anti-replay attack, which can realize effective detection of replay attack. If the server detects that the signature result already exists, it is considered a replay attack, which can ensure the accuracy without introducing additional information.

布隆过滤器是一个高效的时间查询装置,可以把一系列的消息添加到布隆过滤器内,然后查询过滤器内是否存在某个消息,其查询效率和里面保存的消息数量无关。布隆过滤器中的元素容易添加而难以删除,里面的元素超过合理的范围之后,其准确性会大大下降。在一种实现方式中,通过把设定的时间误差范围划分为多个时间片段,并在每个时间片段创建一个布隆过滤器,在该布隆过滤器中保存对应时间片段的相关数据。随着时间的变化,之前创建的布隆过滤器对应的时间片段就会超出设定的时间误差范围,删除超出设定的时间误差范围的布隆过滤器,可以解决布隆过滤器内信息无法删除的问题。如此一来,服务器仅需要保存最大时间误差范围内的数据,而且也只需要对某一个时间片段内的数据进行检查,既节省了服务器的存储空间,而且查询过程耗时较短,大大提升了检测效率。The Bloom filter is an efficient time query device, which can add a series of messages to the Bloom filter, and then query whether there is a certain message in the filter. The query efficiency has nothing to do with the number of messages saved in it. The elements in the Bloom filter are easy to add but difficult to delete. After the elements inside exceed a reasonable range, the accuracy will be greatly reduced. In an implementation manner, the set time error range is divided into multiple time segments, and a Bloom filter is created in each time segment, and the relevant data of the corresponding time segment is stored in the Bloom filter. As time changes, the time segment corresponding to the previously created Bloom filter will exceed the set time error range. Deleting the Bloom filter that exceeds the set time error range can solve the problem that the information in the Bloom filter cannot be Deleted question. In this way, the server only needs to save the data within the maximum time error range, and only needs to check the data in a certain time segment, which not only saves the storage space of the server, but also takes less time for the query process, which greatly improves the detection efficiency.

示例性的,设定的时间误差范围为3分钟,每个时间片段对应1分钟,创建的布隆过滤器如图10所示。过滤器1为已经过期删除的布隆过滤器,过滤器2~过滤器6为有效时间范围内正在使用的布隆过滤器,且过滤器4为当前时间对应的布隆过滤器,过滤器2~过滤器3为早于当前时间3分钟内对应的布隆过滤器,过滤器5~过滤器6为晚于当前时间3分钟内对应的布隆过滤器。比如,当移动App客户端的本地时间比服务端的当前时间快1分钟,则使用过滤器5进行检查。当服务器时间变化到下一分钟时,会创建新的布隆过滤器(过滤器7),有效时间范围内的布隆过滤器也会变为过滤器3~过滤器7,过滤器2过期删除。Exemplarily, the set time error range is 3 minutes, each time segment corresponds to 1 minute, and the created Bloom filter is shown in Figure 10. Filter 1 is the bloom filter that has expired and deleted, filter 2 to filter 6 are the bloom filters in use within the valid time range, and filter 4 is the bloom filter corresponding to the current time, filter 2 ~ Filter 3 is the Bloom filter corresponding to 3 minutes earlier than the current time, and Filter 5 to Filter 6 are the corresponding Bloom filters that are 3 minutes later than the current time. For example, when the local time of the mobile app client is 1 minute faster than the current time of the server, filter 5 is used to check. When the server time changes to the next minute, a new bloom filter (filter 7) will be created, the bloom filter within the valid time range will also become filter 3 to filter 7, and filter 2 will be deleted after expiration .

在另一种实现方式中,也可以使用基于时间片段的数据缓存列表检查签名结果是否已经使用过。数据缓存列表是使用数据列表将接收到的消息数据保存下来,当查询是否存在某个消息时,通过将该消息与缓存列表中的内容一一进行比对来进行判断。In another implementation, a time segment-based data cache list can also be used to check whether the signature result has been used. The data cache list uses the data list to save the received message data. When querying whether there is a certain message, it is judged by comparing the message with the content in the cache list one by one.

通过验证移动App提交的本地时间戳是否处于设定的时间误差范围之内,可以缩小重放攻击的检测范围;使用基于时间片段的布隆过滤器序列或者基于时间片段的数据缓存列表检查签名结果是否已经使用过,可以确定该自动登录过程是否为重放攻击。上述对客户端本地时间戳时效性的验证和基于布隆过滤器的查询的组合使用,既保障了自动登录过程的安全性,同时还保障了自动登录过程的效率。By verifying whether the local timestamp submitted by the mobile app is within the set time error range, the detection scope of replay attacks can be narrowed; the signature result can be checked using a time-segment-based Bloom filter sequence or a time-segment-based data cache list If it has been used, it can be determined whether the automatic login process is a replay attack. The combined use of the above-mentioned verification of the timeliness of the client's local timestamp and the query based on the Bloom filter not only ensures the security of the automatic login process, but also ensures the efficiency of the automatic login process.

S309、服务端的自动登录处理模块向移动App客户端返回错误消息,跳转到S301。S309, the automatic login processing module of the server returns an error message to the mobile App client, and jumps to S301.

S310、服务端的自动登录处理模块调用密钥模块解密自动登录凭据并验证自动登录凭据的完整性,获取自动登录密钥对的公钥和用户名。若解密失败,执行S311;若解密成功,执行S312。S310 , the automatic login processing module of the server invokes the key module to decrypt the automatic login credentials and verify the integrity of the automatic login credentials, and obtain the public key and user name of the automatic login key pair. If the decryption fails, go to S311; if the decryption succeeds, go to S312.

S311、服务端的自动登录处理模块向移动App客户端返回错误消息。客户端接收到该错误消息,删除本地存储中保存的自动登录凭据,跳转到S102。S311. The automatic login processing module of the server returns an error message to the mobile App client. The client receives the error message, deletes the automatic login credentials saved in the local storage, and jumps to S102.

S312、服务端的自动登录处理模块使用获取的自动登录密钥对的公钥,对移动App客户端提交的本地时间戳的签名结果进行验证,若验证失败,执行S313,若验证成功,执行S314。S312. The automatic login processing module of the server verifies the signature result of the local timestamp submitted by the mobile App client using the obtained public key of the automatic login key pair. If the verification fails, perform S313, and if the verification succeeds, perform S314.

利用自动登录密钥对的公钥对移动App客户端提交的签名结果进行验证,能够有效防止攻击者仿冒用户身份进行登录。比如,当移动设备受到攻击时,本地存储中的自动登录凭据被窃取,但TEE中存储的自动登录密钥对无法被窃取。自动登录凭据被窃取后,攻击者可能在客户端生成另外一个自动登录密钥对,使用其生成的自动登录密钥对中的私钥部分对本地时间戳进行签名,并将该签名结果、本地时间戳以及窃取到的自动登录凭据提交到服务器进行自动登录。此次登录过程可以通过步骤S306、S308以及S310的验证。但本次登录过程提交到服务器的签名结果与自动登录密钥对的公钥无法匹配,所以,无法通过验证,验证失败。Using the public key of the automatic login key pair to verify the signature result submitted by the mobile App client can effectively prevent attackers from impersonating the user's identity to log in. For example, when a mobile device is attacked, the auto-login credentials in the local storage are stolen, but the auto-login key pair stored in the TEE cannot be stolen. After the automatic login credentials are stolen, the attacker may generate another automatic login key pair on the client side, use the private key part of the generated automatic login key pair to sign the local timestamp, and use the signature result to the local time stamp. The timestamp and the stolen automatic login credentials are submitted to the server for automatic login. This login process can pass the verification of steps S306, S308 and S310. However, the signature result submitted to the server during this login process cannot match the public key of the automatic login key pair, so the verification fails and the verification fails.

若自动登录凭据中还包含移动App的登录密码,则在自动登录处理模块使用公钥对移动App客户端提交的本地时间戳的签名结果验证成功后,验证该登录密码的正确性,确定登录密码正确后,执行S314。If the automatic login credentials also include the login password of the mobile app, after the automatic login processing module uses the public key to successfully verify the signature result of the local timestamp submitted by the mobile app client, verify the correctness of the login password, and determine the login password After correct, execute S314.

S313、服务端的自动登录处理模块向移动App客户端返回错误消息。客户端接收到该错误消息,移动App客户端删除本地存储中保存的自动登录凭据,跳转到S102。S313. The automatic login processing module of the server returns an error message to the mobile App client. When the client receives the error message, the mobile App client deletes the automatic login credentials saved in the local storage, and jumps to S102.

S314、服务端的自动登录处理模块确定登录成功,创建会话。S314, the automatic login processing module of the server determines that the login is successful, and creates a session.

S315、服务端的自动登录处理模块向移动App客户端返回会话标识。S315. The automatic login processing module of the server returns the session identifier to the mobile App client.

自动登录处理模块将会话标识发送给移动App的客户端,用于移动App客户端与服务端之间传输数据的凭证。The automatic login processing module sends the session identifier to the client of the mobile App, which is used as a credential for data transmission between the client of the mobile App and the server.

本申请实施例提供的移动App登录方法,通过在TEE中生成不可导出的自动登录密钥对,并将自动登录密钥对和用户名等用户身份信息进行绑定,把对用户身份的认证转化为对自动登录密钥对的认证,利用TEE中自动登录密钥对的不可导出防止用户的登录凭据被窃取。即使REE被入侵,只要TEE未被攻破,用户的身份信息便无法被窃取,增强了移动App登录过程的安全性,降低了认证凭据被泄漏的风险。在本申请实施例中,用户名和公钥的绑定关系不在服务器存储,而是使用服务器的密钥模块进行加密后,生成自动登录凭据,保存到移动设备中。在用户登录过程中,移动App使用自动登录密钥对的私钥部分对本地时间戳进行签名,并将自动登录凭据和签名结果提交到服务端,由服务器进行验证、解密,并使用自动登录凭据中的公钥验证签名结果,验证通过后,从自动登录凭据中获取用户的身份信息。本申请实施例不需要在服务端查找公钥和用户名之间的关系,降低了自动登录过程中服务器的数据检索时间和数据存储空间,登录效率不受用户规模的影响。可以在用户规模比较大的场景下,提升登录过程的效率。本申请实施例还通过将自动登录密钥对设置为需要经过生物特征验证后才能对数据进行使用的方式,实现了在每次自动登录过程中都能对用户真实身份进行验证。这样,即使移动设备丢失,或者临时借给其他人使用,也无法冒用用户的身份登录,提升了用户体验。The mobile App login method provided by the embodiments of the present application converts the authentication of the user identity into For the authentication of the automatic login key pair, the non-export of the automatic login key pair in the TEE is used to prevent the user's login credentials from being stolen. Even if the REE is compromised, as long as the TEE is not compromised, the user's identity information cannot be stolen, which enhances the security of the mobile app login process and reduces the risk of leakage of authentication credentials. In the embodiment of the present application, the binding relationship between the user name and the public key is not stored on the server, but is encrypted by the key module of the server, and an automatic login credential is generated and saved in the mobile device. During the user login process, the mobile app uses the private key part of the automatic login key pair to sign the local timestamp, and submits the automatic login credentials and the signature result to the server, where the server verifies, decrypts, and uses the automatic login credentials The public key in verifies the signature result, and after the verification is passed, the user's identity information is obtained from the automatic login credentials. The embodiment of the present application does not need to find the relationship between the public key and the user name on the server side, which reduces the data retrieval time and data storage space of the server during the automatic login process, and the login efficiency is not affected by the user scale. It can improve the efficiency of the login process in scenarios with a large user scale. The embodiment of the present application also realizes that the real identity of the user can be verified in each automatic login process by setting the automatic login key pair to require biometric verification before the data can be used. In this way, even if the mobile device is lost or temporarily lent to others, it is impossible to use the user's identity to log in, which improves the user experience.

可以理解的是,上述移动设备和服务器为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。It can be understood that, in order to implement the above functions, the above-mentioned mobile devices and servers include corresponding hardware structures and/or software modules for executing each function. Those skilled in the art should easily realize that, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in hardware or a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present application.

本申请实施例可以根据上述方法示例对上述移动设备和服务器进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment of the present application, the mobile device and the server can be divided into functional modules according to the above method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. It should be noted that, the division of modules in the embodiments of the present application is schematic, and is only a logical function division, and there may be other division manners in actual implementation.

如图11所示,本申请实施例公开了一种移动设备1100,该移动设备可以为上述实施例中运行了REE和TEE两种操作系统,且在REE操作系统中安装了使用用户身份信息进行登录的移动App的移动设备。As shown in FIG. 11 , an embodiment of the present application discloses a mobile device 1100. The mobile device may run two operating systems, REE and TEE, in the above-mentioned embodiment, and install the REE operating system using user identity information for The mobile device on which the mobile app is logged in.

在一种示例中,请参考图11,其示出了上述实施例中所涉及的移动设备的一种可能的结构示意图。该移动设备1100包括:处理单元1101,存储单元1102,通信单元1103和显示单元1104。In an example, please refer to FIG. 11 , which shows a possible schematic structural diagram of the mobile device involved in the above embodiment. The mobile device 1100 includes: a processing unit 1101 , a storage unit 1102 , a communication unit 1103 and a display unit 1104 .

其中,处理单元1101,用于对移动设备1100的动作进行控制管理。例如,可以用于执行本申请实施例图6中S101、S102、S103,图7中S201-S203、S211以及图9中S301-S305的处理步骤,和/或本申请实施例中其他处理步骤。The processing unit 1101 is configured to control and manage the actions of the mobile device 1100 . For example, it can be used to execute the processing steps of S101, S102, and S103 in FIG. 6, S201-S203, S211 in FIG. 7, and S301-S305 in FIG. 9, and/or other processing steps in the embodiment of the present application.

存储单元1102用于保存移动设备1100的程序代码和数据。例如,可以用于保存登录过程中的相关数据。The storage unit 1102 is used to store program codes and data of the mobile device 1100 . For example, it can be used to save relevant data during the login process.

通信单元1103用于支持移动设备1100与其他设备的通信。例如,可以用于执行本申请实施例图7中S203以及图9中S305的处理步骤,和/或本申请实施例中其他处理步骤。The communication unit 1103 is used to support the communication between the mobile device 1100 and other devices. For example, it may be used to execute the processing steps of S203 in FIG. 7 and S305 in FIG. 9 in this embodiment of the present application, and/or other processing steps in this embodiment of the present application.

显示单元1104用于显示移动设备1100的界面。比如用于显示移动App的用户登录界面810。The display unit 1104 is used to display the interface of the mobile device 1100 . For example, a user login interface 810 for displaying a mobile App.

当然,上述移动设备1100中的单元模块包括但不限于上述处理单元1101,存储单元1102,通信单元1103和显示单元1104。例如,移动设备1100中还可以包括电源单元等。电源单元用于对移动设备1100供电。Of course, the unit modules in the above-mentioned mobile device 1100 include but are not limited to the above-mentioned processing unit 1101 , storage unit 1102 , communication unit 1103 and display unit 1104 . For example, the mobile device 1100 may further include a power supply unit and the like. The power supply unit is used to power the mobile device 1100 .

其中,处理单元1101可以是处理器或控制器,例如可以是中央处理器(centralprocessing unit,CPU),数字信号处理器(digital signal processor,DSP),专用集成电路(application-specific integrated circuit,ASIC),现场可编程门阵列(fieldprogrammable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。存储单元1102可以是存储器。通信单元1103可以是收发器、收发电路等。显示单元1104可以是液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organiclight-emitting diode,OLED)或有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED)等。The processing unit 1101 may be a processor or a controller, such as a central processing unit (CPU), a digital signal processor (DSP), or an application-specific integrated circuit (ASIC). , a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The storage unit 1102 may be a memory. The communication unit 1103 may be a transceiver, a transceiver circuit, or the like. The display unit 1104 may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode, or an active-matrix organic light. emitting diode, AMOLED) and so on.

例如,处理单元1101为处理器(如图3所示的处理器110),存储单元1102可以为存储器(如图3所示的内部存储器121),通信单元1103可以称为通信接口,包括无线通信模块(如图3所示的无线通信模块155),显示单元1104为显示屏(如图3所示的显示屏140,该显示屏140可以为触摸屏,该触摸屏中可以集成显示面板和触控面板)。本申请实施例所提供的移动设备1100可以为图3所示的移动设备100。其中,上述处理器、存储器、通信接口、显示屏等可以连接在一起,例如通过总线连接。For example, the processing unit 1101 may be a processor (such as the processor 110 shown in FIG. 3 ), the storage unit 1102 may be a memory (such as the internal memory 121 shown in FIG. 3 ), and the communication unit 1103 may be referred to as a communication interface, including wireless communication module (the wireless communication module 155 shown in FIG. 3 ), the display unit 1104 is a display screen (the display screen 140 shown in FIG. 3 , the display screen 140 may be a touch screen, and a display panel and a touch panel may be integrated in the touch screen ). The mobile device 1100 provided in this embodiment of the present application may be the mobile device 100 shown in FIG. 3 . Wherein, the above-mentioned processor, memory, communication interface, display screen, etc. can be connected together, for example, through a bus connection.

其中,上述处理器、存储器、通信接口等可以连接在一起,例如通过总线连接。Wherein, the above-mentioned processors, memories, communication interfaces, etc. can be connected together, for example, connected by a bus.

在一种示例中,请参考图12,其示出了上述实施例中所涉及的服务器的一种可能的结构示意图。该服务器1200包括:处理器1201,存储器1202和通信接口1203。In an example, please refer to FIG. 12 , which shows a possible schematic structural diagram of the server involved in the above embodiment. The server 1200 includes: a processor 1201 , a memory 1202 and a communication interface 1203 .

其中,处理器1201是服务器的控制中心,对服务器1200的动作进行控制管理。例如可执行本申请实施例图7中S205、S210的处理步骤,和/或本申请实施例中其他处理步骤。The processor 1201 is the control center of the server, and controls and manages the actions of the server 1200 . For example, the processing steps of S205 and S210 in FIG. 7 in the embodiment of the present application, and/or other processing steps in the embodiment of the present application may be performed.

存储器1202用于保存服务器1200的程序代码和数据。例如,可以用于保存用户账号的用户名和自动登录凭据等相关数据。The memory 1202 is used to store program codes and data of the server 1200 . For example, it can be used to save data related to user accounts such as usernames and automatic login credentials.

通信接口1203用于支持服务器1200与其他设备的通信。例如,可以用于向移动设备发送自动登录凭据和会话标识等。The communication interface 1203 is used to support the communication between the server 1200 and other devices. For example, it can be used to send automatic login credentials and session IDs to mobile devices, etc.

当然,上述服务器1200中的单元模块包括但不限于上述处理器1201,存储器1202和通信接口1203。Certainly, the unit modules in the foregoing server 1200 include but are not limited to the foregoing processor 1201 , memory 1202 and communication interface 1203 .

其中,处理器1201可以是一个处理器,也可以是多个处理元件的统称。例如,处理器1201是一个中央处理器(central processing unit,CPU),也可以是特定集成电路(application specific integrated circuit,ASIC),或者是被配置成实施本申请实施例的一个或多个集成电路,例如:一个或多个微处理器(digital signal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)等。存储器1202可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备等。通信接口1203使用任何收发器一类的装置,用于与其他设备或通信网络通信,如应用服务器、无线接入网(radio access network,RAN),无线局域网(wireless local area networks,WLAN)等。通信接口1203可以包括接收单元实现接收功能,以及发送单元实现发送功能。The processor 1201 may be a processor, or may be a general term for multiple processing elements. For example, the processor 1201 is a central processing unit (CPU), and may also be an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. , for example: one or more microprocessors (digital signal processor, DSP), or, one or more field programmable gate array (field programmable gate array, FPGA) and so on. Memory 1202 may be read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (RAM), or other type of static storage device that can store information and instructions dynamic storage devices, etc. The communication interface 1203 uses any device such as a transceiver for communicating with other devices or communication networks, such as application servers, radio access networks (RAN), wireless local area networks (WLAN), and the like. The communication interface 1203 may include a receiving unit to implement a receiving function, and a transmitting unit to implement a transmitting function.

其中,上述处理器、存储器、通信接口等可以连接在一起,例如通过总线连接。本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序代码,当处理器执行该计算机程序代码时,移动设备执行上述实施例中的方法。Wherein, the above-mentioned processors, memories, communication interfaces, etc. can be connected together, for example, connected by a bus. Embodiments of the present application further provide a computer-readable storage medium, where computer program codes are stored in the computer-readable storage medium, and when the processor executes the computer program codes, the mobile device executes the methods in the foregoing embodiments.

本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序代码,当处理器执行该计算机程序代码时,服务器执行上述实施例中的方法。Embodiments of the present application further provide a computer-readable storage medium, where computer program codes are stored in the computer-readable storage medium, and when the processor executes the computer program codes, the server executes the methods in the foregoing embodiments.

本申请实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述实施例中的方法。Embodiments of the present application also provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute the method in the above-mentioned embodiments.

本申请实施例还提供了一种移动App登录系统,该移动App登录系统包括:移动设备1100和服务器1200。The embodiment of the present application further provides a mobile App login system, where the mobile App login system includes: a mobile device 1100 and a server 1200 .

其中,本申请实施例提供的移动设备1100、服务器1200、计算机可读存储介质、计算机程序产品以及移动App登录系统均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Among them, the mobile device 1100, the server 1200, the computer-readable storage medium, the computer program product, and the mobile App login system provided in the embodiments of the present application are all used to execute the corresponding methods provided above. For the effects, reference may be made to the beneficial effects in the corresponding methods provided above, which will not be repeated here.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。From the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of the description, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be allocated as required. It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be Incorporation may either be integrated into another device, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以使用硬件的形式实现,也可以使用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, and can also be implemented in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, which are stored in a storage medium , including several instructions to make a device (may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a removable hard disk, a ROM, a magnetic disk, or an optical disk and other mediums that can store program codes.

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this, and any changes or substitutions within the technical scope disclosed in the present application should be covered within the protection scope of the present application. . Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (24)

1. A mobile App login method is applied to electronic equipment, the electronic equipment comprises a Trusted Execution Environment (TEE), and the method comprises the following steps:
the electronic equipment receives a user name and a login password of a mobile application program (App) input by a user;
the electronic equipment generates an automatic login key pair; the automatic login key pair comprises a public key and a private key, and is generated and stored by the TEE;
the electronic equipment sends a first login request to a server, wherein the first login request is used for requesting to login the mobile App; the first login request comprises the user name, a login password and the public key;
the electronic device receives an automatic login credential; the automatic login credential is generated according to the user name and the public key;
the electronic equipment receives an operation of opening the mobile App by a user;
in response to the operation of opening the mobile App, the electronic equipment sends a second login request to the server, wherein the second login request is used for requesting to login the mobile App; the second login request comprises a first signature result and the automatic login credential, wherein the first signature result is generated by signing a local timestamp of the electronic device by using the private key; the automatic login credential is used to verify the first signature result.
2. The method of claim 1, further comprising:
the electronic equipment receives a session identification from the server, wherein the session identification is a certificate for transmitting data between the electronic equipment and the server.
3. The method of claim 1 or 2, wherein the second login request further comprises a local timestamp of the electronic device.
4. The method of claim 3, further comprising:
the electronic device receiving a current time of the server from the server;
the electronic equipment sends a third login request to the server, wherein the third login request comprises the current time of the server, a second signature result and an automatic login credential; the second signature result is generated by signing the current time of the server by using the private key.
5. The method of any of claims 1-4, wherein prior to the electronic device sending a second login request to the server, the method further comprises:
the electronic equipment carries out biological feature verification on the user, wherein the biological feature verification comprises at least one of fingerprint identification, face identification and iris identification.
6. A mobile App login method, the method comprising:
the method comprises the steps that a server receives a first login request, wherein the first login request is used for requesting to login the mobile App; the first login request comprises a user name and a login password of the mobile App and a public key of an automatic login key pair;
the server generates an automatic login credential according to the user name and the public key;
the server sends the automatic login credentials to the electronic device;
the server receives a second login request, wherein the second login request is used for requesting to login the mobile App; the second login request comprises a signature result and the automatic login credential, wherein the signature result is obtained by adopting a private key of an automatic login key pair to sign a local timestamp of the electronic equipment;
the server decrypts the automatic login credential and verifies the integrity of the automatic login credential;
if the integrity of the automatic login credential passes the verification, the server acquires the public key according to the automatic login credential and verifies the signature result according to the public key;
and if the signature result is verified according to the public key, the server determines that the mobile App is successfully logged in.
7. The method of claim 6, wherein the server generating auto-login credentials based on the username and the public key comprises:
and the server encrypts the user name and the public key to generate an automatic login credential.
8. The method according to claim 6 or 7, wherein before said verifying the signature result according to the public key, the method further comprises:
verifying that the signature result does not exist at the server.
9. The method of claim 8, wherein the server comprises one or more bloom filters, one for storing signature results over a time range; the second login request further comprises a local timestamp of the electronic device;
the verifying that the signature result does not exist at the server comprises:
acquiring a first bloom filter of the one or more bloom filters according to a local timestamp of the electronic equipment in the second login request;
verifying that the signature result in the second login request is not present in the first bloom filter.
10. The method of claim 9, wherein prior to obtaining a first bloom filter of the one or more bloom filters based on a local timestamp of the electronic device in the second login request, the method further comprises:
and determining that the difference value between the local timestamp of the electronic equipment in the second login request and the current time of the server is smaller than a set time error range.
11. The method of claim 8, further comprising:
and if the difference value between the local timestamp of the electronic equipment in the second login request and the current time of the server is larger than or equal to the set time error range, the server sends the current time of the server to the electronic equipment.
12. The method of any of claims 6-11, wherein prior to the server generating auto-login credentials based on the username and the public key, the method further comprises:
and the server verifies the user name and the login password.
13. The method according to any of claims 6-12, wherein after the server determines that logging on the mobile App is successful, the method further comprises:
and the server sends a session identifier to the electronic equipment, wherein the session identifier is a certificate for transmitting data between the electronic equipment and the server.
14. A mobile App login method is applied to a mobile App login system, the mobile App login system comprises electronic equipment and a server, the electronic equipment comprises a Trusted Execution Environment (TEE), and the method comprises the following steps:
the electronic equipment receives a user name and a login password of a mobile application program (App) input by a user;
the electronic equipment generates an automatic login key pair; the automatic login key pair comprises a public key and a private key, and is generated and stored by the TEE;
the electronic equipment sends a first login request to a server, wherein the first login request is used for requesting to login the mobile App; the first login request comprises the user name, a login password and the public key;
the server receives the first login request and generates an automatic login credential according to the user name and the public key;
the server sends the automatic login credentials to the electronic device;
the electronic equipment receives an operation of opening the mobile App by a user;
in response to the operation of opening the mobile App, the electronic equipment submits a second login request to the server, wherein the second login request is used for requesting to login the mobile App; the second login request comprises a first signature result and the automatic login credential, wherein the first signature result is obtained by signing a local timestamp of the electronic device by using the private key;
the server receives the second login request, and acquires the first signature result and the automatic login credential according to the second login request;
the server decrypts the automatic login credential and verifies the integrity of the automatic login credential;
if the integrity of the automatic login credential passes the verification, the server acquires the public key according to the automatic login credential and verifies the first signature result according to the public key;
and if the first signature result is verified according to the public key, the server determines that the mobile App is successfully logged in.
15. The method of claim 14, wherein after the server determines that logging on the mobile App is successful, the method further comprises:
the server sends a session identifier to the electronic equipment, wherein the session identifier is a certificate for transmitting data between the electronic equipment and the server;
the electronic device receives the session identification.
16. The method of claim 14 or 15, wherein before the electronic device sends the second login request to the server, the method further comprises:
the electronic equipment carries out biological feature verification on the user, wherein the biological feature verification comprises at least one of fingerprint identification, face identification and iris identification.
17. The method according to any of claims 14-16, wherein before the server verifies the first signature result according to the public key, the method further comprises:
the server verifies that the first signature result does not exist at the server.
18. The method of any one of claims 14-17, wherein the server comprises one or more bloom filters, one for storing signature results over a time range; the second login request further comprises a local timestamp of the electronic device;
the server verifying that the first signature result does not exist at the server, comprising:
the server acquires a first bloom filter in the one or more bloom filters according to the local timestamp of the electronic equipment in the second login request;
the server verifies that the first signature result in the second login request is not present in the first bloom filter.
19. The method of claim 18, wherein prior to obtaining a first bloom filter of the one or more bloom filters based on a local timestamp of the electronic device in the second login request, the method further comprises:
and the server determines that the difference value between the local time stamp of the electronic equipment in the second login request and the current time of the server is smaller than a set time error range.
20. The method of claim 19, further comprising:
if the difference value between the local timestamp of the electronic equipment in the second login request and the current time of the server is larger than or equal to the set time error range, the server sends the current time of the server to the electronic equipment;
the electronic device receiving a current time of the server from the server;
the electronic equipment sends a third login request to a server, wherein the third login request comprises the current time of the server, a second signature result and an automatic login credential; and the second signature result is generated by signing the current time of the server by using the private key.
21. An electronic device, comprising: a processor; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to cause the electronic device to implement the method of any of claims 1-5.
22. A server, comprising: a processor; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to cause the server to implement the method of any one of claims 6-13.
23. A computer-readable storage medium comprising computer instructions that, when executed on an electronic device, cause the electronic device to perform the method of any of claims 1-5.
24. A computer-readable storage medium comprising computer instructions that, when executed on an electronic device, cause the server to perform the method of any one of claims 6-13.
CN202110342507.5A 2021-03-30 2021-03-30 A mobile App login method, mobile device and system Pending CN115146253A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110342507.5A CN115146253A (en) 2021-03-30 2021-03-30 A mobile App login method, mobile device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110342507.5A CN115146253A (en) 2021-03-30 2021-03-30 A mobile App login method, mobile device and system

Publications (1)

Publication Number Publication Date
CN115146253A true CN115146253A (en) 2022-10-04

Family

ID=83404292

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110342507.5A Pending CN115146253A (en) 2021-03-30 2021-03-30 A mobile App login method, mobile device and system

Country Status (1)

Country Link
CN (1) CN115146253A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117040941A (en) * 2023-10-10 2023-11-10 北京轻松怡康信息技术有限公司 Account login method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117040941A (en) * 2023-10-10 2023-11-10 北京轻松怡康信息技术有限公司 Account login method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11558381B2 (en) Out-of-band authentication based on secure channel to trusted execution environment on client device
US20200265418A1 (en) Electronic device and method for providing digital signature service of block chain using the same
EP3745290A1 (en) Trusted login method, server, and system
US20140282992A1 (en) Systems and methods for securing the boot process of a device using credentials stored on an authentication token
CN104584023B (en) Method and apparatus for hardware-enforced access protection
US20130068837A1 (en) Mobile computing device authentication using scannable images
CN113259301A (en) Account data sharing method and electronic equipment
CN113132091B (en) Method for sharing equipment and electronic equipment
US20240095329A1 (en) Cross-Device Authentication Method and Electronic Device
US11017066B2 (en) Method for associating application program with biometric feature, apparatus, and mobile terminal
US20210240807A1 (en) Authentication method for mobile terminal and mobile terminal
US12380196B2 (en) Quick response codes for data transfer
CN113821821B (en) Security architecture system, cryptographic operation method of security architecture system and computing device
CN117131481B (en) User login method and electronic equipment
KR20230029690A (en) VPN communication security method and system
US12019717B2 (en) Method for the secure interaction of a user with a mobile terminal and a further entity
WO2022165939A1 (en) Cross-device authentication method and electronic devices
CN115146253A (en) A mobile App login method, mobile device and system
WO2018195759A1 (en) Signature verification method, device and system
CN115080975A (en) Data transmission method and device
CN117176362B (en) Authentication method and device
US20250193167A1 (en) Electronic device and method for performing user authentication on electronic device
CN117852565B (en) NFC card generation method, system, device, electronic equipment and server
CN116049826B (en) TPM-based data protection method, electronic equipment and storage medium
US20210377241A1 (en) Hands free access management and credential protection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination