Home >Web Front-end >Front-end Q&A >What is a public key
The public key is the public part of the key pair and is typically used to encrypt session keys, verify digital signatures, or encrypt data that can be decrypted with the corresponding private key.
A key is a key that the owner of the key should hide on a public key cryptographic infrastructure. In public key cryptography, the public key and secret key are in pairs, and we assume that while the public key is released to a third party, the private key should be kept secret.
Before the emergence of public key cryptography, public key cryptography was usually used because the encryption key and decryption key were the same and by sharing them with the communication partner, encrypted communication was completed. However, public key encryption has no cryptographic meaning if the key is being eavesdropped during the exchange.
With public key encryption, the owner of the key first passes the public key to the communication partner. The communication partner encrypts using this public key and sends the encrypted document (data) to the owner of the key. The owner of the key that receives the encrypted document decrypts the document with the private key. The key required to decrypt the document is not on the communication path. exchange, making it easier to ensure security.
The most widely used public key encryption is RSA encryption. In RSA, the public key and private key have the same structure, and a key encrypted with one key can be decrypted with another key. In other words That said, it can be used not only to encrypt with a public key and decrypt with a private key, but also to encrypt with a public key and decrypt with a public key.
Digital signatures use this feature to make it impossible to create an encrypted document that can be decrypted using a specific public key, except by the person who possesses the key paired with the public key, so that the owner of the key can be guaranteed.
However, it should be noted that the private key and public key of RSA are never symmetrical. It is possible to create a public key from a private key, but creating a key from a public key is considered very difficult and impossible. The security of RSA is based on the fact that it is difficult to factor out a large number of factors, so it is necessary to extend the key length to increase security. sex. Key lengths and algorithms will also change in anticipation of new decoding algorithms being discovered and increasing computational speeds in the future.
The above is the detailed content of What is a public key. For more information, please follow other related articles on the PHP Chinese website!