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

Using external signing service with xmlsec #901

Open
svanschu opened this issue Feb 21, 2025 · 1 comment
Open

Using external signing service with xmlsec #901

svanschu opened this issue Feb 21, 2025 · 1 comment

Comments

@svanschu
Copy link

Use case is to use an external signing service which is set on our side and can't be changed. This signing service takes a hash value and delivers a signature back.

My current approach is to use xmlsec1 cmd line on Linux to

  • create a local signature on a tmp file
  • extract the DigestValue
  • use the extracted DigestValue to create a signature with openssl cmd line
  • add the created signature with xmlstarlet to the to be signed xml

The signature can be verified by openssl and is valid, but I noticed that the format of the signature is different between openssl and xmlsec. Xmlsec can't verify the signature which I created with openSSL.

The signature from openssl always starts wit MI and the signature of xmlsec1 mostly with A. If I'm not wrong openssl seems to create DER and xmlsec1 something not DER.

Is there a way I can

  • extract the hash
  • sign it externaly
  • if needed reformate the signature to a specific format
  • add the signature

with the xmlsec1 cmd line

I'm on the right path or tottaly wrong and evil?

@lsh123
Copy link
Owner

lsh123 commented Feb 21, 2025

XMLSec library implements XML DSig spec (https://www.w3.org/TR/xmldsig-core1/). If the external signing service follows the spec then XMLSec library should be able to verify / sign compatible signatures. If it is something custom and doesn't follow the spec -- then you will have to write something compatible yourself.

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