为什么使用 x.509 证书来加密 xml? 为什么不直接通过 https 传输呢?

发布于 2024-07-22 21:09:18 字数 96 浏览 5 评论 0原文

对加密不太了解...

假设我正在准备提交给身份提供商的 SAML 请求。 为什么我需要为此请求应用 x.509 证书? 仅通过 SSL 传输还不够安全吗?

Don't know much about encryption...

Say I'm preparing a SAML request to submit to an identity provider. Why would I need to apply an x.509 certificate to this request? Is transmission over SSL alone not secure enough?

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

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

发布评论

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

评论(5

花期渐远 2024-07-29 21:09:18

对于 SAML,消息级安全性(即 XML 本身经过签名,有时是加密的),因为通信涉及不直接通信的各方。 SSL/TLS 用于传输级安全,仅在直接通信的两方之间以及仅在该通信期间使用。

根据您使用的 SAML 绑定,该对话框可能如下所示(例如,沿着 Shibboleth 的行):

  • 用户的浏览器连接到服务提供商 (SP)
  • SP 向用户提供 SAML 请求,该请求不一定可见,但隐藏在表单或等效内容中。
  • 用户的浏览器(直接连接到 IdP)将 SAML 请求发送到 IdP。
  • 用户使用它进行身份验证并获取 SAML 响应。
  • 用户的浏览器将该 SAML 响应发送到 SP。

在这种情况下,尽管涉及所有 3 方,但 SP 和 IdP 之间没有直接的 SSL/TLS 连接。 (这种情况的某些变体涉及 SP 和 IdP 之间针对属性的后端通信,但这是一个不同的问题。)

  • SSL/TLS 连接不足以让 IdP 知道 SAML 请求来自 SP它允许验证和释放属性,因为与 IdP 的连接来自用户的浏览器,而不是 SP 本身。 因此,SP 必须先对 SAML 请求消息进行签名,然后再将其传递给用户的浏览器。
  • SSL/TLS 连接不足以让 SP 知道 SAML 响应来自其信任的 IdP。 同样,这就是 SAML 响应本身也被签名的原因。

如果中间方(即用户)不打算查看 SAML 消息中的内容和/或用户与 SP 或 IdP 之间的连接不是通过 SSL/TLS 进行的,则适用于签名的内容也适用于加密(通常应该通过 HTTPS 进行)。

In the case of SAML, message-level security (i.e. the XML itself is signed and sometimes encrypted) because the communication involves parties that don't communicate directly. SSL/TLS is for transport-level security, only used between the two parties that are communicating directly and for the duration of this communication only.

Depending on which SAML binding you use, the dialog can look like this (e.g. along the lines of Shibboleth):

  • User's browser connects to Service Provider (SP)
  • SP gives the user a SAML request, not necessarily visible, but hidden within a form or equivalent.
  • User's browser (in a direct connection to the IdP) sends the SAML request to the IdP.
  • The user authenticates with it and gets a SAML response back.
  • The user's browser sends that SAML response to the SP.

In this scenario, there is no direct SSL/TLS connection between the SP and the IdP, although all 3 parties are involved. (Some variants of this involve a back-end communication between SP and IdP for attributes, but that's a different problem.)

  • An SSL/TLS connection wouldn't be sufficient for the IdP to know that the SAML request came from an SP for which it's allowed to authenticate and release attribute, since the connection to the IdP comes from the user's browser, not the SP itself. For this reason, the SP must sign the SAML request message before handing it to the user's browser.
  • An SSL/TLS connection wouldn't be sufficient for the SP to know the SAML response came from an IdP it trusts. Again, that's why the SAML response itself is also signed.

What applies to signing also applies to encryption, if the middle party, i.e. the user, isn't meant to see what's in the SAML message and/or if the connection between the user and the SP or IdP isn't over SSL/TLS (usually, it should be over HTTPS).

活泼老夫 2024-07-29 21:09:18

是的 - SSL 就足够了 - 但 SSL 只能是点对点的。 如果源计算机和目标计算机之间存在一些中介,则无法使用 SSL 保护连接。

在这种情况下,例如通过互联网传输时,您必须保护实际消息,而不是传输层。 这就是为什么您需要加密 XML(或至少是其中的一部分)。

马克

Yes - SSL is enough - but SSL is only point-to-point. You cannot secure your connection using SSL if there are a few intermediaries in the way between your source and your target machine.

In that case, e.g. when transmitting over the internet, you must safeguard the actual message, instead of the transport-level. That's why you need to encrypt the XML (or at least parts of it).

Marc

夏九 2024-07-29 21:09:18

HTTPS 所做的只是加密两点之间的通信并防止窃听者 - 它不会确认发送消息的人是谁。 如果您的消息随后被转发,也无法保证安全通信。

如果您使用 X.509 证书签署您的请求,您可以放心解密者拥有证书中包含的共享秘密。 换句话说,您可以放心,该消息只能由您希望解密的组织解密。

就您而言,X.509 加密要求意味着您应该确信身份提供商是唯一会收到您的请求的组织。

有用的维基百科入门指南位于此处

All that HTTPS will do is encrypt the communication between two points and prevent eavesdroppers -- it won't confirm who it was that sent the message. Neither will it assure secure communication if your message is then forwarded.

If you sign your request with the X.509 certificate you can be assured the decryptor has the shared secret contained in certificate. In other words, you can be assured the message can only be decrypted by the organisation you want it to be decrypted by.

In your case, the X.509 encryption requirement means that you should be assured that the identity provider is the only organisation that will receive your request.

A useful Wikipedia primer is here.

浅忆流年 2024-07-29 21:09:18

很可能是因为他们想验证您(客户)的身份。 HTTPS 可用于客户端身份验证,但在实践中很少。

Most likely because they want to authenticate you (the client). HTTPS can be used for client authentication, but it rarely is in practice.

梦一生花开无言 2024-07-29 21:09:18

实际上,您可以使用 HTTPS (SSL/TLS) 来保护您的 SAML 消息。 但是您可能希望使用双向 SSL 证书验证/确认,这意味着您的客户端需要验证服务器的 X.509 证书,并且服务器需要配置为执行客户端身份验证,这需要它检查 X.509 证书。客户端提供的 509 证书。 因此,无论如何,客户端都需要自己的证书。

SSL/TLS 并不是真正为此设计的...它的设计目的是为了保护网络流量在传输过程中不被看到,并且让客户端能够知道他们正在与哪个服务器通信并向哪个服务器发送敏感信息(它是真正为电子商务而设计,其中客户(购买商品的用户)知道他们将信用卡信息发送给谁)。 就 SAML 而言,重点是让各方知道他们正在交换的信息在传输过程中没有被更改,并且每个人都在与他们认为自己的身份进行对话。 使用证书来签署/加密该消息本身就可以实现这一点。

In practice, you could use HTTPS (SSL/TLS) to protect your SAML message. But you would want to use two-way SSL certificate verification/validation, meaning your client would need to verify the server's X.509 certificate and the server would need to be configured to perform client authentication, which would require it to check an X.509 certificate that the client presents. So, the client would need its own certificate anyway.

SSL/TLS is not really designed for this...it was/is designed to protect web traffic from being seen while in transport and for the client to be able to tell what server they are talking to and sending sensitive information to (it was really designed for e-commerce where the client (user buying something) knows who they are sending their credit card information to). In the case of SAML, the whole point is for the parties to know that the information they are exchanging has not been altered in transport and that each is talking to who they think they are. Using certificates to sign/encrypt that message itself accomplishes that.

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