selective-php / xmldsig

Sign XML Documents with Digital Signatures
MIT License
73 stars 34 forks source link

Get only the signature #24

Closed Zen0x7 closed 1 year ago

Zen0x7 commented 1 year ago

Hi @odan

I was looking your code and seems good but in my use case seems like not really friendly.

Anyways i wanna contribute to make more friendly.

So with this PR you can get only the signature if you're trying to make a signature and append the signature where you want.

What you think about?

odan commented 1 year ago

Hi @SpiritSaint

Thanks for your PR. Can you please describe first what the actual issue or use-case is?

I generally try to avoid boolean parameters, so maybe we need to find another implementation.

Zen0x7 commented 1 year ago

@odan imagine that you need to generate a signature for a document but the result need to be used in a different way that the package was created.

In my case, i need to append a signature by elements, appending the signature after every the element. at the end, i need to append a global signature in the document.

So it's more easy for me just get the signature and append that where i want.

As the package append the signature inside the root element it's a problem, because i need to add that where some integration documentation indicates me.

In other hand, other use case that i'm viewing, is i can store the signature independant in a database table.

odan commented 1 year ago

I will give feedback as soon as possible.

odan commented 1 year ago

Have you tried to use the DOMDocument and signDocument method as shown in the example? By combining multiple elements, it should also allow you to combine everything with a global signature.

https://github.com/selective-php/xmldsig#signing-only-specific-part-of-an-xml-document