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

[ENHANCEMENT]: wssecurity - getCertFromKeyInfo not possible #461

Open
shunkica opened this issue Apr 4, 2024 · 1 comment
Open

[ENHANCEMENT]: wssecurity - getCertFromKeyInfo not possible #461

shunkica opened this issue Apr 4, 2024 · 1 comment

Comments

@shunkica
Copy link
Contributor

shunkica commented Apr 4, 2024

Is your feature request related to a problem? Please describe...

In wssecurity, the certificate is not contained within KeyInfo, instead KeyInfo only contains a reference to the BinarySecurityToken element, which contains the certificate.

Therefore the current getCertFromKeyInfo function can not be used to retrieve the certificate when wssecurity is used.

The BinarySecurityToken is also not inside the Signature element, so traversing to parents from the KeyInfo element is not possible.

Describe teh solution you'd like...

getCertFromKeyInfo currently only gets the KeyInfo node, but it should also be passed the Security element when wsssecurity is used. Alternatively, the root xml node should also be passed to getCertFromKeyInfo

const key = this.getCertFromKeyInfo(this.keyInfo) || this.publicCert || this.privateKey;

Most simple solution would be:
const key = this.getCertFromKeyInfo(this.keyInfo, doc) || this.publicCert || this.privateKey;

Describe the alternatives you've considered...

Parsing the xml outside the library and injecting the BinarySecurityToken into the SignedXml publicCert property

@cjbarth
Copy link
Contributor

cjbarth commented Apr 4, 2024

This seems reasonable. If possible, please reference the spec on this and feel free to put up a PR that will do this. It seems that if the doc is being passed, then this.keyInfo wouldn't also be needed, but I'll wait for commenting until I see what code solution you have in mind.

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

No branches or pull requests

2 participants