公钥加密是如何工作的

发布于 2024-09-02 02:30:19 字数 190 浏览 6 评论 0原文

我对 RSA 的理解是,Alice 可以创建公钥和私钥组合,然后将公钥发送给 Bob。然后鲍勃可以使用公钥加密某些内容,而爱丽丝将使用公钥和私钥组合来解密它。

但是,Alice 如何加密要发送给 Bob 的内容?鲍勃将如何解密它?我之所以这么问,是因为我很好奇当我登录银行网站时,银行如何向我发送在线报表等数据。我的浏览器如何解密该信息?我没有私钥。

What I understand about RSA is that Alice can create a public and a private key combination, and then send the public key over to Bob. And then afterward Bob can encrypt something using the public key and Alice will use the public and private key combo to decrypt it.

However, how can Alice encrypt something to be sent over to Bob? How would Bob decrypt it? I ask because I'm curious how when I log onto my banking site, my bank sends me data such as my online statements. How does my browser decrypt that information? I don't have the private key.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

毁虫ゝ 2024-09-09 02:30:19

基本上,该过程是:

  1. 客户端连接到服务器并请求服务器的证书。该证书包含公钥和有关服务器身份的信息。
  2. 假设客户端对服务器的身份感到满意,它会生成一个随机数P并使用服务器的公钥对其进行加密。
  3. 只有服务器可以解密P(使用它的私钥 - 不与任何人共享),因此当客户端将加密的随机数发送到服务器时,服务器会对其进行解密。
  4. 客户端和服务器都使用 P 生成用于对称加密算法的对称密钥,因为只有客户端和服务器知道所使用的 P 的值,所以安全生成密钥。

Basically, the procedure is:

  1. The client connects to the server and asks for the server's certificate. The certificate contains the public key and information about the server's identity.
  2. Assuming the client is happy with the server's identity, it generates a random number P and encrypts it with the server's public key.
  3. Only the server can decrypt P (with it's private key - not shared with anybody) so when the client sends the encrypted random number to the server, the server decrypts it.
  4. The client and server both use P to generate a symmetric key for use in a symmetric encryption algorithm, safe in the knowledge that only the client and server know the value of P used to generate the key.
我做我的改变 2024-09-09 02:30:19

Alice 将使用公钥和私钥组合来解密

Alice 将使用她的私钥对其进行解密。

但是,Alice 如何加密要发送给 Bob 的内容? Bob 将如何解密它?

Alice 需要 Bob 的公钥才能向他发送某些内容。
通常,公钥加密用于身份验证、不可否认性(如签名)和对称密钥的分发(这对于加密/解密长消息来说速度更快)。

Alice will use the public and private key combo to decrypt it

Alice would just decrypt it with her private key.

However, how can Alice encrypt something to be sent over to Bob? How would Bob decrypt it?

Alice would need Bob's public key to send something to him.
Typically, public key encryption is used for authentication, non-repudiation (like signing), and distribution of symmetric keys (which are faster for encrypting/ decrypting long messages).

再可℃爱ぅ一点好了 2024-09-09 02:30:19

很简单,你需要一把钥匙。

SSL/TLS 通过在连接设置期间创建对称会话密钥来解决此问题。公钥加密用于建立此会话密钥,然后将其用于双向数据通信。 了解有关 TLS 的更多信息

Simple, you need a key.

SSL/TLS solves this problem by creating a symmetric session key during the connection setup. The public key cryptography is used to establish this session key, which is then used for bi-directional data communication. Read more about TLS

み青杉依旧 2024-09-09 02:30:19

这个视频不是我创作的,但有人与我分享了这个视频,它让这个理论变得更有意义。一如既往,细节决定成败(实施)。

http://www.youtube.com/watch?v=YEBfamv-_do

I didn't create this, but someone shared this video with me and it helped the theory make much more sense. As always the devil's in the details (implementation).

http://www.youtube.com/watch?v=YEBfamv-_do

披肩女神 2024-09-09 02:30:19

总的来说,在准备 Microsoft C# 认证的同时,我花了很长一段时间努力理解公钥加密技术以及 PKI 的其他元素(例如数字签名和证书)。

我在 cgi.com 上看到了一份简明而详细的 PDF 形式的解释。我知道又回到了好心的爱丽丝和鲍勃身边!但它确实通过图表和注释为我理清了思路,最后还提出了一些发人深省的问题。绝对推荐它。

访问http://www.cgi.com/files/white-papers/cgi_whpr_35_pki_e。 pdf

On a general note I struggled to understand Public Key Cryptography for quite a while along with the other elements of PKI such as Digital Signatures and Certificates whilst preparing for Microsoft C# certification.

I came across an explanation in the form of a concise and detailed PDF at cgi.com. I know it's back to good old Alice and Bob! but it really cleared things up for me with its diagrams and notes and also has some thought provoking questions at the end. Definitely recommend it.

Visit http://www.cgi.com/files/white-papers/cgi_whpr_35_pki_e.pdf

只是一片海 2024-09-09 02:30:19

但是,Alice 如何加密要发送给 Bob 的内容?鲍勃将如何解密它?我之所以这么问,是因为我很好奇当我登录银行网站时,银行如何向我发送在线报表等数据。我的浏览器如何解密该信息?我没有私钥。

这就是你错的地方;您确实拥有私钥。作为握手过程的一部分,每一方都会生成两个密钥:公钥和私钥。客户端将其公钥发送到服务器,服务器将使用它来加密发送到客户端的所有数据。同样,服务器生成两个密钥并将其公钥发送到客户端,客户端将使用它来加密发送到服务器的所有数据。

在许多场景中,非对称密钥算法仅用于交换另一个密钥,该密钥用于对称算法。

However, how can Alice encrypt something to be sent over to Bob? How would Bob decrypt it? I ask because I'm curious how when I log onto my banking site, my bank sends me data such as my online statements. How does my browser decrypt that information? I don't have the private key.

This is where you're wrong; you do have a private key. As part of the handshaking process, each side generates two keys: a public key and a private key. The client sends its public key to the server, who will use it to encrypt all data sent to the client. Likewise, the server generates both keys and sends its public key to the client, which will use it to encrypt all data sent to the server.

In many scenarios, the asymmetric key algorithm is used only to exchange another key, which is for a symmetric algorithm.

故事与诗 2024-09-09 02:30:19

在这种情况下,爱丽丝将使用鲍勃的公钥来加密数据,然后鲍勃将使用他的私钥对其进行解密。

本质上,公钥加密数据,私钥解密该数据。由于每个用户都有公钥和私钥,因此您可以安全地将数据发送给任何其他用户。

In this situation, Alice would use Bob's public key to encrypt the data and Bob would then decrypt it with his private key.

Essentially, a public key encrypts data and a private key decrypts that data. Since every user has both a public and private key, you can securely send data to any other user.

海未深 2024-09-09 02:30:19

如果您连接到银行的站点,它会执行很多加密操作。最重要的是,您使用银行的公钥向银行发送一条信息,因为在每个 SSL (https) 连接服务器发送到客户端时,它的公钥都打包为证书。

证书和全球 PKI 的使用很重要。您需要确保,如果您向银行提供您的银行密码,则另一方确实是您的银行,而不是其他人。这将得到解决,因为每台计算机上都有少量知名组织(例如 VeriSign)的公钥,并且银行不仅向您发送他的服务器公钥,而且还向您发送证书。例如,证书是由 VeriSign 签名的消息,其中表示“此公钥确实来自银行 XYZ”。因此,因为您有 VeriSign 的公钥,所以您可以首先验证银行的服务器证书是否正确。因此您可以确信,您与银行进行了真正的沟通

If you connect to the site of your bank it works a lot of cryptographic things. The most important is that you use public key of the bank to send a piece of information to the bank, because in every SSL (https) connection server send to client it's public key packed as a certificate.

Usage of certificate and world wide PKI is important. You want be sure, that if you gives to the bank your bank pin, that on the other side is really your bank and not an other person. This will be solved, because on every computers there are a small number of public keys of well known organisations (like VeriSign) and bank send you not only his server public key, but a certificate. certificate is a message signed by VeriSign for example, which say "this public key is really from the bank XYZ". So because you have public key of VeriSign you can first verify, that server certificate of the bank is correct. So you can be sure, that you communicate really with your bank.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文