The application relates to the technical field of
computer security, and discloses a two-factor
authentication method and
system, which is based on a two-factor
authentication technology of biological information and public key
encryption. In the method, a public key
encryption scheme with semantic security and a
hash function with robust reserved predicate relation are used to realize an
authentication process, and the method has the ability to
resist replay attacks and malicious
server attacks. Specifically, the scheme uses a
server to randomly generate a challenge number and uses a user public key to encrypt and send the challenge number, so as to
resist replay attacks; and the scheme uses two-factor authentication of a biological authentication factor and a private
key authentication factor to
resist malicious user attacks. Meanwhile, the scheme uses the
hash function with robust reserved predicate relation to protect biological feature information of a user, and uses the public key
encryption scheme with semantic security to protect private key information of the user, so as to resist malicious
server attacks. The application significantly improves the security and efficiency of authentication, and can better meet the needs of users.