Device interaction method and apparatus, electronic device, storage medium
A method for device interaction includes: receiving identity authentication information input by a user in a case that a cross-device identity authentication function of a first device is enabled; and sending an identity authentication request to a second device that has established communication with the first device, wherein the identity authentication information is carried in the identity authentication request, and the identity authentication request is configured to request the second device in a locked state to perform identity authentication according to the identity authentication information.
1 . A device interaction method performed by a first device, comprising:
receiving identity authentication information input by a user in a case that a cross-device identity authentication function of the first device is enabled; and
acquiring first shared information;
obtaining a first key and a second key according to the first shared information;
performing data type conversion on the identity authentication information input by the user, to obtain the identity authentication information of byte array type;
encrypting the identity authentication information of byte array type using the first key, to obtain encrypted information of the first device;
signing the encrypted information of the first device based on the second key, to obtain signature information of the first device;
splicing the signature information of the first device and the encrypted information of the first device, to obtain ciphertext information;
generating an identity authentication request according to the ciphertext information; and
sending the identity authentication request to a second device that has established communication with the first device, wherein the identity authentication information is carried in the identity authentication request, and the identity authentication request is configured to request the second device in a locked state to perform identity authentication according to the identity authentication information.
2 . The method according to claim 1 , further comprising:
receiving first verification information; and
enabling the cross-device identity authentication function of the first device in response to the first verification information being verified.
3 . A non-transitory computer-readable storage medium storing instructions that, when executed by a processor of an electronic device, cause the electronic device to perform the device interaction method according to claim 1 .
4 . A device interaction method performed by a second device, comprising:
acquiring second shared information;
obtaining key information of the second device based on the second shared information, wherein the key information of the second device comprises a first key and a second key;
receiving an identity authentication request sent by a first device that has established communication with the second device, wherein a cross-device identity authentication function of the second device is enabled and the second device is in a locked state, and wherein the identity authentication request is generated based on ciphertext information;
splitting the ciphertext information to obtain split encrypted information and split signature information;
judging whether ciphertext signature verification is successful based on the first key and the split signature information;
decrypting the split encrypted information using the second key in a case that the ciphertext signature verification is successful, to obtain decrypted information; and
performing identity authentication on the second device in response to the identity authentication request based on the decrypted information.
5 . The method according to claim 4 , further comprising:
receiving second verification information; and
enabling the cross-device identity authentication function of the second device in response to the second verification information being verified.
6 . The method according to claim 4 , wherein the judging whether ciphertext signature verification is successful based on the first key and the split signature information comprises:
signing the split signature information using the first key to obtain signature verification information; and
determining that the ciphertext signature verification is successful in a case that the signature verification information is same as the split signature information.
7 . The method according to claim 4 , further comprising:
stopping decryption of the split encrypted information in response to failure of the ciphertext signature verification.
8 . The method according to claim 4 , further comprising:
after the cross-device identity authentication function of the second device is enabled, detecting input information of the second device; and
in response to the input information of the second device being used to represent disabling the cross-device identity authentication function, and identity verification of input user of the second device being verified, closing an entrance to the cross-device identity authentication function of the second device and deleting the key information of the second device.
9 . An electronic device, comprising:
a hardware processor; and
a hardware memory configured to store instructions executable by the processor;
wherein the processor is configured to perform the device interaction method according to claim 4 .
10 . A non-transitory computer-readable storage medium storing instructions that, when executed by a processor of an electronic device, cause the electronic device to perform the device interaction method according to claim 4 .
11 . An electronic device, comprising:
a hardware processor; and
a hardware memory configured to store instructions executable by the processor;
wherein the processor is configured to:
receive identity authentication information input by a user in a case that a cross-device identity authentication function of the electronic device is enabled;
acquire first shared information;
obtain a first key and a second key according to the first shared information;
perform data type conversion on the identity authentication information input by the user, to obtain the identity authentication information of byte array type;
encrypt the identity authentication information input by the user based on the first key, to obtain encrypted information of a first device;
sign the encrypted information of the first device based on the second key, to obtain signature information of the first device;
splice the signature information of the first device and the encrypted information of the first device, to obtain ciphertext information;
generate an identity authentication request according to the ciphertext information; and
send the identity authentication request to a second device that has established communication with the electronic device, wherein the identity authentication information is carried in the identity authentication request, and the identity authentication request is configured to request the second device in a locked state to perform identity authentication according to the identity authentication information.