SSL如何使用对称和非对称加密?如何管理一台主机上多个站点的认证?

发布于 2024-10-07 17:55:14 字数 976 浏览 9 评论 0原文

首先,引用 Microsoft TechNet 的管理 Microsoft 证书服务和 SSL

回顾一下,安全 SSL 会话是使用以下技术建立的:

  1. 用户的 Web 浏览器使用安全 URL 联系服务器。

  2. IIS 服务器向浏览器发送其公钥和服务器证书。

  3. 客户端和服务器协商用于加密的级别 安全通信。

  4. 客户端浏览器使用服务器的公钥加密会话密钥 密钥并将加密数据发回 到服务器。

  5. IIS 服务器使用其私有密钥解密客户端发送的消息 键,会话建立。

  6. 客户端和服务器端都使用会话密钥进行加密和解密 传输数据。

所以,基本上来说,SSL使用非对称加密(公钥/私钥对)来传递共享会话密钥,最终实现了对称加密的通信方式。

这是对的吗?

添加 - 1 - 5:55 PM 12/17/2010

我正在使用 IIS 托管我的网站。假设我的一台计算机上有多个站点,并且我希望客户端浏览器使用 SSL URL 来连接我的站点。我需要多少证书?我应该采取以下哪种方法?

1 - 申请单个证书并将其关联到托管多个站点的单个服务器计算机。

2 - 申请多个证书并将我的每个站点与其自己的证书相关联。

在 IIS7 中,似乎我只能执行方法 1。

更新 - 1 - 6:09 PM 12/17/2010

我弄清楚了。我可以在我的服务器计算机上安装多个证书,并根据需要使用单独的证书绑定每个站点。

First, some quotation from Microsoft TechNet's Managing Microsoft Certificate Services and SSL:

To recap, secure SSL sessions are established using the following technique:

  1. The user's Web browser contacts the server using a secure URL.

  2. The IIS server sends the browser its public key and server certificate.

  3. The client and server negotiate the level of encryption to use for the
    secure communications.

  4. The client browser encrypts a session key with the server's public
    key and sends the encrypted data back
    to the server.

  5. The IIS Server decrypts the message sent by the client using its private
    key, and the session is established.

  6. Both the client and the server use the session key to encrypt and decrypt
    transmitted data.

So, basically speaking, the SSL use the asymmetric encryption (public/private key pair) to deliver the shared session key, and finally achieved a communication way with symmetric encryption.

Is this right?

Add - 1 - 5:55 PM 12/17/2010

I am using IIS to host my websites. Suppose I have multiple sites on my single machine, and I want the client brower to use SSL URL to connect my sites. How many certificates do I need? Which of the following approach should I take?

1 - Apply for a single certicate and associate it to my single server machine which hosts mutiple sites.

2 - Apply for several certificates and associate each of my sites with its own certificate.

In IIS7, it seems I could only do approach 1.

Update - 1 - 6:09 PM 12/17/2010

I figure it out. I could install mutiple certificates on my server machine and bind each site with seperate certificate as necessary.

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

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

发布评论

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

评论(7

抹茶夏天i‖ 2024-10-14 17:55:21

SSL 客户端发送随机字节字符串,使客户端和服务器能够计算用于加密后续消息数据的密钥。随机字节串本身使用服务器的公钥加密(非对称)。

SSL 使用非对称和对称密钥。

The SSL client sends the random byte string that enables both the client and the server to compute the secret key to be used for encrypting subsequent message data. The random byte string itself is encrypted with the server's public key(Asymmetric).

SSL uses both Asymmetric and symmetric keys.

茶底世界 2024-10-14 17:55:20

会话密钥由客户端和服务器独立计算而无需传输密钥的情况是 Diffie-Hellman 密钥交换:
https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
---看漂亮的油漆插图
PKI 将在客户端和服务器之间交换加密的会话密钥。

The case where the session key is independently computed by the client and server without the key ever being transmitted is Diffie-Hellman key exchange:
https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
--- see the nice paint illustration
PKI will exchange the encrypted session key between the client and server.

时光是把杀猪刀 2024-10-14 17:55:17

服务器上的每个侦听端口只能有一个 SSL 证书。这是因为发送的第一件事是服务器证书(如您的时间线中所示)。这是在 HTTP 请求之前,因此如果您尝试在单个服务器上托管两个域(例如 foo.com 和 bar.com),服务器将无法知道要向客户端发送哪个证书。

有几种不同的方法可以解决此问题:

  1. 在不同的服务器上托管不同的域
  2. 在不同的端口上托管不同的域(例如,foo.com 从 443 提供服务,bar.com 从 8443 提供服务)。如果您将主机放在多个负载均衡器后面,则可以让它们为 443 上的所有站点提供服务。
  3. 如果不同的域都是单个父域的子域,则可以获得通配符证书。 (例如,域名 www.foo.com、bar.foo.com 和 baz.foo.com 都可以使用 *.foo.com 的证书)
  4. 为其中一个域获取单个证书,并将其他域列为 AltNames 。 (例如 foo.com 和 bar.com 都可以使用带有 bar.com AltName 的 foo.com 证书)

You can only have a single SSL cert per listening port on the server. This is because the very first thing that is sent is the server certificate (as in your timeline). This is before the HTTP request so if you try to host two domains on a single server (say foo.com and bar.com) there is no way for the server to know which certificate to send to the client.

There are a few different ways to solve this problem:

  1. Host different domains on different servers
  2. Host different domains on different ports (eg. foo.com is serverd from 443 and bar.com is served from 8443). If you put your host behind multiple load-balancers, you can have them service all the sites on 443.
  3. If the different domains are all sub-domains of a single parent domain, you can get a wildcard certificate. (e.g. domains www.foo.com, bar.foo.com, and baz.foo.com can all use a certificate for *.foo.com)
  4. Get a single certificate for one of the domains and have the other domains listed as AltNames. (e.g. both foo.com and bar.com can use a foo.com certificate with a bar.com AltName)
凝望流年 2024-10-14 17:55:16

第 4 点和第 5 点是错误的。服务器和客户端独立计算相同的会话密钥。它实际上从未被传输过。

You're wrong at points 4 and 5. The server and client independently compute the same session key. It is never actually transmitted at all.

惟欲睡 2024-10-14 17:55:16

答案是两者皆有。您将在下面的 digicert.com 中找到 4 个步骤的详细解释:

输入图片此处描述

  • 服务器发送其非对称公钥的副本。
  • 浏览器创建对称会话密钥并使用服务器的非对称公钥对其进行加密。然后发送到服务器。
  • 服务器使用其非对称私钥解密加密的会话密钥,以获得对称会话密钥。
  • 服务器和浏览器现在使用对称会话密钥加密和解密所有传输的数据。这允许安全通道,因为
    只有浏览器和服务器知道对称会话密钥,并且
    会话密钥仅用于该会话。如果浏览器是
    第二天连接到同一服务器,新的会话密钥将是
    创建。

https://www.digicert.com/ssl-cryptography.htm

.

The answer is both. You will find a nice explanation in 4 steps from digicert.com below:

.

enter image description here

  • Server sends a copy of its asymmetric public key.
  • Browser creates a symmetric session key and encrypts it with the server's asymmetric public key. Then sends it to the server.
  • Server decrypts the encrypted session key using its asymmetric private key to get the symmetric session key.
  • Server and Browser now encrypt and decrypt all transmitted data with the symmetric session key. This allows for a secure channel because
    only the browser and the server know the symmetric session key, and
    the session key is only used for that session. If the browser was to
    connect to the same server the next day, a new session key would be
    created.

https://www.digicert.com/ssl-cryptography.htm

策马西风 2024-10-14 17:55:16

我建议您将更新作为单独的问题发布。

无论如何 - 您将需要多个证书 - 每个站点一个。请记住,这些证书将您的机器与您的地址联系起来。由于每个网站(可能)都有不同的地址,因此每个网站都需要不同的证书

I would suggest that you post your update as a separate question.

In any case - you will require multiple certificate - one per site. Remember that these certificates tie your machine to your address. Since each of the websites is going to have a different address (potentially) , you need different certs for each of the sites

君勿笑 2024-10-14 17:55:15

是的,没错。非对称加密对于验证其他人的身份是必要的,然后使用对称加密,因为它更快。

Yes, that's right. Asymmetric encryption is necessary to verify the others identity and then symmetric encryption gets used because it's faster.

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