An electronic device comprising: a communication circuit; a security circuit; at least one processor operatively connected to the communication circuit and the security circuit; and memory operatively connected to the at least one processor, wherein the memory stores instructions that, when executed by the at least one processor, cause the electronic device to: receive a public key from an external electronic device as a peer to peer, P2P, service is requested, generate an authentication certificate chain, based on the received public key, transmit, to the external electronic device through the communication circuit, the authentication certificate chain generated based on the received public key, verify an authentication certificate chain received from the external electronic device by using a root authentication certificate stored in the security circuit, receive encrypted information on the external electronic device from the external electronic device, decrypt the encrypted information on the external electronic device by using a shared key generated based on a result of the verifying the received authentication certificate chain, and perform the P2P service with the external electronic device through the communication circuit based on the decrypted information on the external electronic device. a communication circuit; a security circuit; at least one processor operatively connected to the communication circuit and the security circuit; and memory operatively connected to the at least one processor, wherein the memory stores instructions that, when executed by the at least one processor, cause the electronic device to: receive a public key from an external electronic device as a peer to peer, P2P, service is requested, generate an authentication certificate chain, based on the received public key, transmit, to the external electronic device through the communication circuit, the authentication certificate chain generated based on the received public key, verify an authentication certificate chain received from the external electronic device by using a root authentication certificate stored in the security circuit, receive encrypted information on the external electronic device from the external electronic device, decrypt the encrypted information on the external electronic device by using a shared key generated based on a result of the verifying the received authentication certificate chain, and perform the P2P service with the external electronic device through the communication circuit based on the decrypted information on the external electronic device. receive a public key from an external electronic device as a peer to peer, P2P, service is requested, generate an authentication certificate chain, based on the received public key, transmit, to the external electronic device through the communication circuit, the authentication certificate chain generated based on the received public key, verify an authentication certificate chain received from the external electronic device by using a root authentication certificate stored in the security circuit, receive encrypted information on the external electronic device from the external electronic device, decrypt the encrypted information on the external electronic device by using a shared key generated based on a result of the verifying the received authentication certificate chain, and perform the P2P service with the external electronic device through the communication circuit based on the decrypted information on the external electronic device.