Modify DigestMethod of EncryptedKey

Bergmann, Clemens clemens.bergmann at tu-darmstadt.de
Thu Sep 26 13:45:37 UTC 2024


Hi,

 

I have a SP using keycloak. Since some Versions Keycloak is no longer supporting “RSA_SHA1 and DSA_SHA1 algorithms for SAML” [1].

I am using the default “shibboleth.EncryptionConfiguration.GCM” security configuration for my IdP. The signatures produced by this are sha512 and accepted by this SP. However the Assertions are rejected because the EncryptedKey uses the DigestMethod of “http://www.w3.org/2000/09/xmldsig#sha1” and a MGF of “http://www.w3.org/2009/xmlenc11#mgf1sha1”. 

 

Here is a Fragment from an assertion that shows that result:

 

<saml2p:Response [...] >

    [...]

    <saml2:EncryptedAssertion [...]>

        <xenc:EncryptedData [...]>

            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">

                <xenc:EncryptedKey [...]>

                    <xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#rsa-oaep"

                                           xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"

                                           >

                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"

                                         xmlns:ds="http://www.w3.org/2000/09/xmldsig#"

                                         />

                        <xenc11:MGF xmlns:xenc11="http://www.w3.org/2009/xmlenc11#"

                                    Algorithm="http://www.w3.org/2009/xmlenc11#mgf1sha1"

                                    />

                    </xenc:EncryptionMethod>

                    <ds:KeyInfo>

                        <ds:X509Data>

                            <ds:X509Certificate>[...]</ds:X509Certificate>

                        </ds:X509Data>

                    </ds:KeyInfo>

                    <xenc:CipherData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">

                        <xenc:CipherValue>[...]</xenc:CipherValue>

                    </xenc:CipherData>

                </xenc:EncryptedKey>

            </ds:KeyInfo>

            <xenc:CipherData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">

                <xenc:CipherValue>[...]</xenc:CipherValue>

            </xenc:CipherData>

        </xenc:EncryptedData>

    </saml2:EncryptedAssertion>

</saml2p:Response>

 

I looked into the code and could not find a way to specify this in the security configuration.

 

There could be a way to specify it in the metadata but adding the following did not help:

<EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#rsa-oaep">

  <xenc11:MGF Algorithm="http://www.w3.org/2001/04/xmlenc#MGF1withSHA256" />

  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />

<EncryptionMethod>

 

Is there another way to influence the IdP to use for example sha265 for that DigestMethod?

 

[1] https://www.keycloak.org/docs/latest/upgrading/index.html#deprecated-rsa_sha1-and-dsa_sha1-algorithms-for-saml

 

With kind regards

Clemens

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20240926/3e8773dd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7338 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/users/attachments/20240926/3e8773dd/attachment.p7s>


More information about the users mailing list