You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constassertion='<THE XML HERE>'constsigner=newSignedXml({// From my X.509 certificate file
privateKey,
publicCert,});signer.computeSignature(assertion);constsignedAssertion=signer.getSignedXml();
signer.addReference({xpath: "/"});// since I want to sign the whole document?
Gives:
/me/project/node_modules/xml-crypto/src/utils.ts:20
for (let i = 0; i < element.attributes.length; i++) {
^
TypeError: Cannot read properties of null (reading 'length')
at Object.findAttr (/me/project/node_modules/xml-crypto/src/utils.ts:20:42)
Here is an example of signing SAML 2.0 response with xml-crypto (with version < 4.0.0): node-saml/passport-saml#836 (comment)
It is trivial to modify that example to handle just Assertion input. Just drop code related to handling of surrounding Response and make minor modifications to xpaths related to Assertion signing. Pay attention to placement of signature element in the resulting signed Assertion (for further information see example code's code comments).
btw. your example Assertion's subject confirmation's NotOnOrAfter="2020-08-21T09:23:24.511Z" is in the past. You would have hard time to get that through any SAML 2.0 SP side stack (assuming your SP has been implemented properly).
Activity
srd90 commentedon Oct 6, 2023
IMHO this is more like a discussion item/question and proper place would have been https://github.com/node-saml/xml-crypto/discussions instead of issue #393.
Here is an example of signing SAML 2.0 response with
xml-crypto(with version< 4.0.0): node-saml/passport-saml#836 (comment)It is trivial to modify that example to handle just
Assertioninput. Just drop code related to handling of surroundingResponseand make minor modifications to xpaths related to Assertion signing. Pay attention to placement of signature element in the resulting signed Assertion (for further information see example code's code comments).btw. your example Assertion's subject confirmation's
NotOnOrAfter="2020-08-21T09:23:24.511Z"is in the past. You would have hard time to get that through any SAML 2.0 SP side stack (assuming your SP has been implemented properly).