Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

XMLSignatureUtil.setIncludeKeyInfoInSignature(false) fails to disinclude KeyInfo from a signature after signing #46302

@mschenkeeper

Description

@mschenkeeper

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

saml

Describe the bug

When includeKeyInfoInSignature is set to false and sign is called with a null keyName, an IllegalArgumentException is thrown. When includeKeyInfoInSignature is set to false and sign is called with a non-null keyName, KeyInfo is included in the SAML as a stub:

<dsig:KeyInfo>
    <dsig:KeyName/>
</dsig:KeyInfo>

Version

26.5.3

Regression

  • The issue is a regression

Expected behavior

Per section 4.5 of the standard, KeyInfo is an optional element. The expectation is that when includeKeyInfoInSignature is set to false, calls to sign will successfully result in a Signature that does not contain the KeyInfo element.

Actual behavior

When includeKeyInfoInSignature is set to false, KeyInfo is included in the Signature if keyName is non-null, and an exception is thrown if keyName is null.

How to Reproduce?

Set XMLSignatureUtil.setIncludeKeyInfoInSignature(false), then call XMLSignatureUtil.sign.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions