公钥加密 [英] Public Key Encryption
问题描述
我正在考虑使用公开密钥加密的两台计算机之间的通信。
I was thinking about communication between two computers using public-key encryption.
让我们假设在一台计算机端生成私钥和公钥。如果我将公共密钥发送到另一台计算机,它是否仍然可以被数据包嗅探器捕获,并使用它来解密我的消息?如果是的话,可以做些什么来防止这种情况,以及什么是使用公钥加密?
Let us assume that on one computer side I generate a private key and a public key. If I send the public key to the other computer, can it still be captured by a packet sniffer and use it to decrypt my message? If yes, what can be done to prevent this and what is the use of public key encryption then?
更新
SSL是否等同于公钥加密?我应该用它吗?
Is SSL equivalent to public-key encryption? Should I use it instead?
推荐答案
否。公钥不用于解密,而是加密。你用你的私钥解密。这样,只有你可以解密该消息。
No. The public key is not used to decrypt, but to encrypt. You decrypt with your private key. That way, only you can decrypt the message.
通常,私有密钥加密对于加密数据来说太贵了。您将使用私有/公共加密方案来交换共享密钥(大随机数)来加密您的数据。
Usually though, private-public key encryption is too expensive to encrypt data with. You'd use a private/public encryption scheme to exchange a shared key (large random number) to encrypt your data with.
示例:Alice创建一个私有/公钥密码将公钥发送给Bob。 Bob创建一个大的随机数,并用Alice的公钥进行加密。爱丽丝可以解密,找到大的随机数。 Alice和Bob然后使用随机数加密他们的数据流。
Example: Alice creates a private/public keypair, sends the public key to Bob. Bob creates a large random number and encrypts it with Alice's public key. Alice can decrypt that and find the large random number. Alice and Bob then use the random number to encrypt their data stream.
作为额外的安全性,您可以定期更改密钥。
As additional security, you could change keys periodically.
要更新您的SSL问题:它的工作原理与上述相同。另见 http://en.wikipedia.org/wiki/Transport_Layer_Security
To update on your SSL question: it works exactly as I describe above. See also http://en.wikipedia.org/wiki/Transport_Layer_Security
这篇关于公钥加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!