A key configuration method, wherein the method comprises: acquiring, by a first device, a public key of a second device through a secure medium; and sending, by the first device, information used for obtaining a shared key to the second device, so that the second device obtains a shared key by using a private key of the second device and the information that is used for obtaining a shared key, wherein the first device obtains the shared key by using a private key of the first device, wherein the first device and the second device perform a secure connection by using the shared key or a derivative key of the shared key; wherein the acquiring, by a first device, a public key of a second device through a secure medium comprises: acquiring, by the first device, the public key of the second device from the second device in a manner of scanning an identifier; wherein the method further comprises: predetermining, by the first device and the second device, a key exchange algorithm; the information used for obtaining a shared key is specifically: a public key of the first device; the obtaining, by the first device, the shared key by using a private key of the first device comprises: generating, by the first device, the shared key by using the public key of the second device and the private key of the first device according to the key exchange algorithm; and the obtaining, by the second device, a shared key by using a private key of the second device and the information that is used for obtaining a shared key comprises: generating, by the second device, the shared key by using the public key of the first device and the private key of the second device according to the key exchange algorithm; wherein the predetermining, by the first device and the second device, a key exchange algorithm comprises: receiving, by the first device and the second device, a parameter used by the key exchange algorithm and sent by a third-party configuration device. acquiring, by a first device, a public key of a second device through a secure medium; and sending, by the first device, information used for obtaining a shared key to the second device, so that the second device obtains a shared key by using a private key of the second device and the information that is used for obtaining a shared key, wherein the first device obtains the shared key by using a private key of the first device, wherein the first device and the second device perform a secure connection by using the shared key or a derivative key of the shared key; wherein the acquiring, by a first device, a public key of a second device through a secure medium comprises: acquiring, by the first device, the public key of the second device from the second device in a manner of scanning an identifier; wherein the method further comprises: predetermining, by the first device and the second device, a key exchange algorithm; the information used for obtaining a shared key is specifically: a public key of the first device; the obtaining, by the first device, the shared key by using a private key of the first device comprises: generating, by the first device, the shared key by using the public key of the second device and the private key of the first device according to the key exchange algorithm; and the obtaining, by the second device, a shared key by using a private key of the second device and the information that is used for obtaining a shared key comprises: generating, by the second device, the shared key by using the public key of the first device and the private key of the second device according to the key exchange algorithm; acquiring, by the first device, the public key of the second device from the second device in a manner of scanning an identifier; wherein the method further comprises: predetermining, by the first device and the second device, a key exchange algorithm; the information used for obtaining a shared key is specifically: a public key of the first device; the obtaining, by the first device, the shared key by using a private key of the first device comprises: generating, by the first device, the shared key by using the public key of the second device and the private key of the first device according to the key exchange algorithm; and the obtaining, by the second device, a shared key by using a private key of the second device and the information that is used for obtaining a shared key comprises: generating, by the second device, the shared key by using the public key of the first device and the private key of the second device according to the key exchange algorithm; wherein the predetermining, by the first device and the second device, a key exchange algorithm comprises: receiving, by the first device and the second device, a parameter used by the key exchange algorithm and sent by a third-party configuration device.