【发布时间】:2014-09-05 04:03:41
【问题描述】:
规范说:
Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0
2.4.1.1 元素
<KeyDescriptor>
<KeyDescriptor>元素提供有关加密密钥的信息 实体用于签署数据或接收加密密钥,以及其他 加密细节。它的KeyDescriptorType复杂类型包括 以下元素和属性:
use[可选]可选属性,指定所描述键的用途。值来自 KeyTypes 枚举,由值
encryption和signing组成。
<ds:KeyInfo>[必填]直接或间接标识键的可选元素。
据我所知,为了双向发送安全数据,我应该:
- 我自己的私钥
- 我自己的公钥
- 收件人的公钥
我应该在 SP 元数据中指定什么密钥的证书,我可以使用相同的证书进行签名和加密吗?
IdP 的供应商提供了所谓的“元数据模板”,其中指明了应该拼写的内容和位置。
以下是相关部分(逐字):
...
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
<!--
TODO It is necessary to insert here the certificate of the signature
key of the service provider in X509 DER format and Base64 encoded
-->
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:KeyDescriptor use="encryption">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
<!--
TODO It is necessary to insert here the certificate of the signature
key of the service provider in X509 DER format and Base64 encoded
-->
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
...
我这样做:
...
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
MIID...ZiQ==
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:KeyDescriptor use="encryption">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
MIID...ZiQ==
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
...
它不起作用。
因此,AFAIK 进行签名时我应该使用我的私钥证书,而对于加密我应该使用 IdP 的开放密钥证书。
恕我直言应该是这样。
...
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
<!-- certificate of my private key here-->
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:KeyDescriptor use="encryption">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
<!-- certificate of the open key of IdP here -->
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
...
我说的对吗?
【问题讨论】:
标签: cryptography saml-2.0 shibboleth service-provider