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
Is your feature request related to a problem? Please describe...
In
wssecurity, the certificate is not contained withinKeyInfo, insteadKeyInfoonly contains a reference to theBinarySecurityTokenelement, which contains the certificate.Therefore the current
getCertFromKeyInfofunction can not be used to retrieve the certificate when wssecurity is used.The
BinarySecurityTokenis also not inside theSignatureelement, so traversing to parents from theKeyInfoelement is not possible.Describe teh solution you'd like...
getCertFromKeyInfocurrently only gets theKeyInfonode, but it should also be passed theSecurityelement whenwsssecurityis used. Alternatively, the root xml node should also be passed togetCertFromKeyInfoxml-crypto/src/signed-xml.ts
Line 267 in 0ed7ab2
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
BinarySecurityTokeninto the SignedXmlpublicCertproperty