Skip to content

Bump robrichards/xmlseclibs - #426

Open
tvdijen wants to merge 1 commit into
release-4.xfrom
ugprade/xmlseclibs
Open

tvdijen wants to merge 1 commit into
release-4.xfrom
ugprade/xmlseclibs

Conversation

@tvdijen

@tvdijen tvdijen commented Oct 18, 2026

Copy link
Copy Markdown
Member

No description provided.

@tvdijen

tvdijen commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

Ben did a great job in figuring out that this has to do with padding. Sent an e-mail to Rob R. to figure out if we're using his library in the wrong way, or we hit a bug.

@monkeyiq

Copy link
Copy Markdown
Contributor

I might add some of the transcript of that here for reference.

The failing test in question can be executed locally with

phpunit  ./tests/SAML2/SignedElementHelperTest.php --filter=testValidateWithoutModification

Note that to run that test on Fedora (44) you may have to set the following to allow the algo to work.

export OPENSSL_ENABLE_SHA1_SIGNATURES=1

In the specific test, the copying is not the problem. rr xmlsec 4.x will not validate the original element that is presentde here either.

If in configureRSAKey() you set the following at the top of the method then the test passes:

$this->cryptParams['padding'] = 64; 
// or as Tim discovered 16 works too.

Glad I could help a little. It might be that the padding needs to be slightly different on the enc/sign key use or we are making the key with intent to encrypt and not sign or something. That configureRSAKey call is buried inside verifySignature() so I'm not too sure what a caller of the rr lib could do to easily change it.

Also in Utils / validateSignature() you can do something like:

         if( $algo == XMLSecurityKey::RSA_1_5 ) {         
            $key->adjustPadding(16);
        }

with a suitable adjustPadding that sets the padding in xmlseckey again, probably not ideal but avoids stamping the padding for all keys.

public function adjustPadding( $mask )
    {
        $this->cryptParams['padding'] &= ~(RSA::ENCRYPTION_PKCS1);
        $this->cryptParams['padding'] |= $mask;
        return $this;
    }

None of this is a recommendation for changes to the rr lib. My familiarity with the internals there is not where it needs to be to make any such suggestion. These are just things I found while trying to get this particular test case to pass. It might be useful at some stage so I have copied it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants