Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Need To Set Attribute URI = '' #235

Open
feader opened this issue Sep 23, 2021 · 1 comment
Open

When Need To Set Attribute URI = '' #235

feader opened this issue Sep 23, 2021 · 1 comment

Comments

@feader
Copy link

feader commented Sep 23, 2021

https://github.com/robrichards/xmlseclibs/blob/master/src/XMLSecurityDSig.php#L662
in XMLSecurityDSig.php, function addRefInternal, when (! $node instanceof DOMDocument) = false , it has no value, so make the URI='' is not exist , it show 'ds:Reference', in my scene, i need it to be '<ds:Reference URI=''>'

so I add else for it
image

what i need now is work

image

image

@feader feader changed the title When Set Attribute URI = '' When Need To Set Attribute URI = '' Sep 23, 2021
@Mats
Copy link

Mats commented May 15, 2024

If I have understood your problem correctly; that you would like to have <ds:Reference URI=""> instead of ds:Reference you can pass in the option force_uri when signing:

// Sign using SHA-256 
$objDSig->addReference( 
    $doc,  
    XMLSecurityDSig::SHA256,  
    ['http://www.w3.org/2000/09/xmldsig#enveloped-signature'],
    ['force_uri' => true] // <----- this causes $force_uri to be true, which in turn results in the attribute URI="" being added
);

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

No branches or pull requests

2 participants