A network configuration method for use in a first device, comprising: acquiring a public key operation value of a second device and key information of the second device in an out-of-band manner, wherein the public key operation value of the second device is a result obtained by performing an operation of a preset algorithm on a public key that is used by the second device to perform key exchange; generating public key information of the first device according to a public key that is used by the first device to perform key exchange, and sending the public key information of the first device to the second device, so that the second device acquires the public key of the first device according to the public key information of the first device; wherein the generating public key information of the first device according to a public key that is used by the first device to perform key exchange comprises: performing, a symmetric encryption operation on the public key that is used by the first device to perform key exchange, to generate the public key information of the first device, by using the key information of the second device or the public key operation value of the second device as a symmetric encryption key; acquiring a public key copy of the second device that is sent by the second device and that is used to perform key exchange; and performing an operation of the preset algorithm on the public key copy of the second device, to obtain a public key operation value copy of the second device; and after the public key operation value copy of the second device matches the public key operation value of the second device, generating a first exchange key according to a private key that is used by the first device to perform key exchange and the acquired public key copy of the second device, so as to process configuration information between the first device and the second device by using the first exchange key. acquiring a public key operation value of a second device and key information of the second device in an out-of-band manner, wherein the public key operation value of the second device is a result obtained by performing an operation of a preset algorithm on a public key that is used by the second device to perform key exchange; generating public key information of the first device according to a public key that is used by the first device to perform key exchange, and sending the public key information of the first device to the second device, so that the second device acquires the public key of the first device according to the public key information of the first device; wherein the generating public key information of the first device according to a public key that is used by the first device to perform key exchange comprises: performing, a symmetric encryption operation on the public key that is used by the first device to perform key exchange, to generate the public key information of the first device, by using the key information of the second device or the public key operation value of the second device as a symmetric encryption key; acquiring a public key copy of the second device that is sent by the second device and that is used to perform key exchange; and performing an operation of the preset algorithm on the public key copy of the second device, to obtain a public key operation value copy of the second device; and after the public key operation value copy of the second device matches the public key operation value of the second device, generating a first exchange key according to a private key that is used by the first device to perform key exchange and the acquired public key copy of the second device, so as to process configuration information between the first device and the second device by using the first exchange key. <EOS>