📜  私钥和公钥的区别

📅  最后修改于: 2021-09-14 01:24:12             🧑  作者: Mango

密码学是一门秘密写作的科学,目的是保持数据的机密性。密码学分为对称密码学、非对称密码学和散列。

私钥:
在私钥中,加密和解密使用相同的密钥(秘密密钥)。这个密钥是对称的,因为唯一的密钥是由另一方复制或共享以解密密文。它比公钥密码学更快。

公钥:
在公钥中,使用两个密钥,一个用于加密,另一个用于解密。一个密钥(公钥)用于加密明文以将其转换为密文,另一个密钥(私钥)用于接收方解密密文以读取消息。

现在,我们看到它们之间的区别:

S.NO Private Key Public Key
1. Private key is faster than public key. It is slower than private key.
2. In this, the same key (secret key) and algorithm is used to encrypt and decrypt the message. In public key cryptography, two keys are used, one key is used for encryption and while the other is used for decryption.
3. In private key cryptography, the key is kept as a secret. In public key cryptography, one of the two keys is kept as a secret.
4. Private key is Symmetrical because there is only one key that is called secret key. Public key is Asymmetrical because there are two types of key: private and public key.
5. In this cryptography, sender and receiver need to share the same key. In this cryptography, sender and receiver does not need to share the same key.
6. In this cryptography, the key is private. In this cryptography, public key can be public and private key is private.