验证无中间证书的签名 [英] Validating a signature without intermediate certificate

查看:225
本文介绍了验证无中间证书的签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以验证只在层次结构中具有祖先或根证书的签名吗



免责声明:考虑以下情况。










  • 我们有两方(我们称之为身份提供商的 IdP 和服务提供商的 SP )和某些中央认证中心

  • CA拥有自己的证书 CertCA ,可用于IdP和SP(已导入IdP和SP的密钥库)

  • Out CA为IdP( CertIdP )颁发一个证书,为SP( CertSP )颁发一个证书。
  • IdP在其密钥库中具有CertIdP,并且知道其密码,因此IdP可以使用CertIdP对邮件进行签名

  • 与SP / CertSP相同

  • 现在让我们假设SP不知道CertIdP,IdP不知道CertSP。他们只知道用来签署CertIdP和CertSP的CertCA。 (我知道,我们有一个证书层次CertIdP - > CertCA < - CertSP here - )

  • IdP想要发送一个签名的消息到SP。它创建一个消息,然后使用CertIdP对其签名。

  • SP接收由IdP使用CertIdP签名的消息。如上所述,SP没有CertIdP,只有父证书CertCA。



我的问题是:由CertIdP签署的消息的签名只有其父证书CertCA?



背景,为什么要这样。

>

我们正在使用PicketLink实现基于SAML的SSO。我们正在使用PicketLink的 SAML2SignatureValidationHandler 验证签名。为了实现这一点,服务提供商(SP)需要在其密钥库中具有IdP的证书。当一个签名的SAML断言传递给SP时,此处理程序使用IdP的证书来验证签名。



上述过程运行良好,但我们有一些组织关注。此过程假定SP具有用于验证的IdP证书。如果发生更改,IdP的证书必须在SP端更换。



由于CertIdP和CertSP都是由相同的机构(CA)颁发的,因此我们可能会有大量的SP这是IdP和SP的绝对信任,我们有一个想法,我们可以使用CA的证书进行签名验证。如果这样工作,这可能会消除在IdP和SP之间交换证书的需要。 CA的证书也非常长寿,所以如果只需要永远交换一次(永恒,我们的大约10-20年)。



然而,我不知道是否在技术上可能验证签名与CertIdP只有父CertCA签名。是否可以?



如果它是相关的,我们在Java / JBoss平台上的SP端,IdP是一个第三方软件。 p>

更新:



这是我从IdP获得的签名: / p>

 < ds:Signature xmlns:ds =http://www.w3.org/2000/09/xmldsig# > 
< ds:SignedInfo>
< ds:CanonicalizationMethod Algorithm =http://www.w3.org/2001/10/xml-exc-c14n#/>
< ds:SignatureMethod Algorithm =http://www.w3.org/2000/09/xmldsig#rsa-sha1/>
< ds:Reference URI =#_...>
< ds:Transforms>
< ds:Transform
Algorithm =http://www.w3.org/2000/09/xmldsig#enveloped-signature/>
< ds:Transform Algorithm =http://www.w3.org/2001/10/xml-exc-c14n#>
< ec:InclusiveNamespaces xmlns:ec =http://www.w3.org/2001/10/xml-exc-c14n#
PrefixList =ds saml samlp/>
< / ds:Transform>
< / ds:Transforms>
< ds:DigestMethod Algorithm =http://www.w3.org/2000/09/xmldsig#sha1/>
< ds:DigestValue> r ... =< / ds:DigestValue>
< / ds:Reference>
< / ds:SignedInfo>
< ds:SignatureValue> X ... ==< / ds:SignatureValue>
< / ds:Signature>


解决方案

这取决于您的SAML响应是否包含签名证书< ds:X509Data> ...< / ds:X509Data> 或只是公钥< ds:KeyValue& / ds:KeyValue>

 < saml2p:Response xmlns:saml2p =urn :oasis:names:tc:SAML:2.0:protocol...> 
...
< ds:Signature xmlns:ds =http://www.w3.org/2000/09/xmldsig#>
< ds:SignedInfo> ...< / ds:SignedInfo
< ds:SignatureValue> ...< / ds:SignatureValue>
< ds:KeyInfo>
< ds:X509Data>
< ds:X509Certificate> ...< / ds:X509Certificate>
< / ds:X509Data>
< / ds:KeyInfo>
< / ds:Signature>
< / saml2p:Response>

vs。

 code>< saml2p:Response xmlns:saml2p =urn:oasis:names:tc:SAML:2.0:protocol...> 
...
< ds:Signature xmlns:ds =http://www.w3.org/2000/09/xmldsig#>
< ds:SignedInfo> ...< / ds:SignedInfo
< ds:SignatureValue> ...< / ds:SignatureValue>
< ds:KeyInfo>
< ds:KeyValue>
< ds:RSAKeyValue>
< ds:Modulus> ...< / ds:Modulus>
< ds:Exponent> ...< / ds:Exponent>
< / ds:RSAKeyValue>
< / ds:KeyValue>
< / ds:KeyInfo>
< / ds:Signature>
< / saml2p:Response>

如果嵌入了签名证书,它可能包含AuthorityInfoAccess扩展,通常包含http或ldap发布CA证书的URL。使用从签名证书到受信任的CA证书的这些扩展,您将能够构建受信任的证书链。 (注:如果CertCA实际上是CertIdP和CertSP的直接发行者,那么您已经拥有所需的可信证书链。)



但是,如果您只有公钥需要有手头的签名证书来匹配公钥。因此,它归结为配置/分配问题。您可以提供一个Web服务,返回所请求的公钥的相应签名证书。如果在SP的本地密钥库中找不到签名证书,它将联系Web服务以检索新的CertIdP并将其添加到本地密钥库。保留本地密钥库是与性能,可用性和隐私权相关的。


Is it possible to validate a signature only having an ancestor or root certificate in the hierarchy?

Disclaimer: I'm a newbie to the certificates handling so please forgive the naive terminology.

Consider the following situation.

  • We have two parties (let's call them IdP for Identity Provider and SP for service provider) and some central certificate authority CA which is definitely trusted by both IdP and SP.
  • CA has it's own certificate CertCA known to both IdP and SP (imported into IdP's and SP's keystore under some alias)
  • Out CA issues one certificate for IdP (CertIdP) and one for SP (CertSP).
  • IdP has CertIdP in its keystore and knows password for it so IdP can sign messages with CertIdP
  • Same for SP/CertSP
  • Now let's assume that SP does not know CertIdP and IdP does not know CertSP. They only know CertCA which was used to sign CertIdP and CertSP. (As I understand, we have a certificate hierarchy CertIdP --> CertCA <-- CertSP here-)
  • IdP wants to send a signed message to SP. It creates a message and then uses CertIdP to sign it.
  • SP receives the message signed by the IdP using CertIdP. As noted above, SP does not have the CertIdP, only the parent certificat CertCA.

My question is: Can SP validate the signature of the message signed by CertIdP only having its parent certificate CertCA?

Backstory, why want it.

We're implementing SAML-Based SSO with PicketLink. We're using PicketLink's SAML2SignatureValidationHandler to validate signatures. To achieve this, Service Provider (SP) needs to have IdP's certificate in its keystore. When a signed SAML assertion is passed to SP, this handler uses the IdP's certificate to validate the signature.

The process above works well, but we have some organisational concerns. This process assumes that SP has the IdP's certificate for validation. In case something changes, IdP's certificate must be replaced on the SP side. We may have a large number of SPs (hunreds when not thousands) so this is quite an effort.

Since both CertIdP and CertSP are issued by the same authority (CA) which is definitely trusted by both IdP and SP, we had the idea that we may use the CA's certificate for signature validation. If this works, this might eliminate the need to exchange certificates between IdP and SP. The CA's certificate is also very "long-living" so if only have to be exchanged once in eternity (eternity, in our case is around 10-20 years).

However I am not sure if it is technically possible to validate the signature signed with CertIdP only having the parent CertCA. Is it possible? Or are we on completely wrong track here?

If it's relevant, we're on Java/JBoss platform on SP side, IdP is a third-party software.

Update:

This is the signature I get at the moment from IdP:

    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:SignedInfo>
            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
            <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
            <ds:Reference URI="#_...">
                <ds:Transforms>
                    <ds:Transform
                        Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                    <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
                            PrefixList="ds saml samlp" />
                    </ds:Transform>
                </ds:Transforms>
                <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                <ds:DigestValue>r...=</ds:DigestValue>
            </ds:Reference>
        </ds:SignedInfo>
        <ds:SignatureValue>X...==</ds:SignatureValue>
    </ds:Signature>

解决方案

it depends whether your SAML response contains the signing certificate <ds:X509Data>...</ds:X509Data> or just the public key <ds:KeyValue>...</ds:KeyValue> of it.

<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" ...>
  ...
  <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>...</ds:SignedInfo
    <ds:SignatureValue>...</ds:SignatureValue>
    <ds:KeyInfo>
      <ds:X509Data>
        <ds:X509Certificate>...</ds:X509Certificate>
      </ds:X509Data>
    </ds:KeyInfo>
  </ds:Signature>
</saml2p:Response>

vs.

<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" ...>
  ...
  <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>...</ds:SignedInfo
    <ds:SignatureValue>...</ds:SignatureValue>
    <ds:KeyInfo>
      <ds:KeyValue>
        <ds:RSAKeyValue>
          <ds:Modulus>...</ds:Modulus>
          <ds:Exponent>...</ds:Exponent>
        </ds:RSAKeyValue>
      </ds:KeyValue>
    </ds:KeyInfo>
  </ds:Signature>
</saml2p:Response>

If the signing certificate is embedded, it may contain the AuthorityInfoAccess extension, which usually contains an http or ldap URL to the issuing CA certificate. Using these extensions from the signing certificate to the trusted CA certificate, you would be able to build the trusted certificate chain. (Note: If the CertCA is actually the direct issuer of CertIdP and CertSP you already have the required trusted certificate chain.)

However, if you only got the public key you need to have the signing certificate at hand to match the public key against. So then it comes down to a provisioning/distribution problem. You could provide a web service that returns the corresponding signing certificate for the requested public key. If the signing certificate was not found in the SP's local keystore it would contact the web service to retrieve the new CertIdP and add it to the local keystore. Keeping the local keystore is performance, availability and privacy relevant.

这篇关于验证无中间证书的签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆