SP元数据:用于签名和加密的证书

Ale*_*kov 6 cryptography shibboleth service-provider saml-2.0

规范说:

OASIS安全断言标记语言(SAML)V2.0的元数据

2.4.1.1元素 <KeyDescriptor>

<KeyDescriptor>元素提供有关实体用于签名数据或接收加密密钥的加密密钥的信息,以及其他加密详细信息.其 KeyDescriptorType复杂类型包含以下元素和属性:

use[可选的]

可选属性,指定所描述的密钥的用途.值是从KeyTypes枚举中提取的,由值encryption和值组成signing.

<ds:KeyInfo>[需要]

直接或间接标识密钥的可选元素.

据我所知,为了向两个方向发送安全数据,我应该:

  1. 我自己的私钥
  2. 我自己的公钥
  3. 收件人的公钥

我应该在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> 
...
Run Code Online (Sandbox Code Playgroud)

我这样做:

...   
<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>
...
Run Code Online (Sandbox Code Playgroud)

这是行不通的.

因此,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>
...
Run Code Online (Sandbox Code Playgroud)

我对吗?

我非常感谢这些信息.谢谢大家.

Vla*_*fer 6

您自己的服务的元数据应包含您的公钥和证书.是的,您可以使用相同的签名和加密.

当IDP想要加密要发送到SP的数据时,它使用SP的公钥来实现.因此,不需要包含"IdP的开放密钥证书"作为加密密钥.

您提到使用相同的密钥进行签名和加密都不起作用,您是否能够获得有关确切失败的详细信息以及位置?

  • 阿列克谢,欢迎你.是的,从SP发送到IdP的请求通常不使用XML加密.该消息通常通过https通道发送,该通道已提供传输层加密,因此无需在消息层上再次对其进行加密. (3认同)