diff --git a/src/signed-xml.ts b/src/signed-xml.ts index ca19db7..e5d80af 100644 --- a/src/signed-xml.ts +++ b/src/signed-xml.ts @@ -149,8 +149,8 @@ export class SignedXml { } this.implicitTransforms = implicitTransforms ?? this.implicitTransforms; this.keyInfoAttributes = keyInfoAttributes ?? this.keyInfoAttributes; - this.getKeyInfoContent = getKeyInfoContent ?? SignedXml.noop; - this.getCertFromKeyInfo = getCertFromKeyInfo ?? this.getCertFromKeyInfo; + this.getKeyInfoContent = getKeyInfoContent ?? this.getKeyInfoContent; + this.getCertFromKeyInfo = getCertFromKeyInfo ?? SignedXml.noop; this.CanonicalizationAlgorithms; this.HashAlgorithms; this.SignatureAlgorithms; diff --git a/test/document-tests.spec.ts b/test/document-tests.spec.ts index 0ade323..fc321c9 100644 --- a/test/document-tests.spec.ts +++ b/test/document-tests.spec.ts @@ -47,6 +47,7 @@ describe("Validated node references tests", function () { const xml = fs.readFileSync("./test/static/valid_saml.xml", "utf-8"); const doc = new xmldom.DOMParser().parseFromString(xml); const sig = new SignedXml(); + sig.getCertFromKeyInfo = SignedXml.getCertFromKeyInfo sig.loadSignature(sig.findSignatures(doc)[0]); const validSignature = sig.checkSignature(xml); expect(validSignature).to.be.true; @@ -73,6 +74,7 @@ describe("Validated node references tests", function () { const xml = fs.readFileSync("./test/static/valid_saml.xml", "utf-8"); const doc = new xmldom.DOMParser().parseFromString(xml); const sig = new SignedXml(); + sig.getCertFromKeyInfo = SignedXml.getCertFromKeyInfo sig.loadSignature(sig.findSignatures(doc)[0]); const validSignature = sig.checkSignature(xml); expect(validSignature).to.be.true; @@ -86,6 +88,7 @@ describe("Validated node references tests", function () { const xml = fs.readFileSync("./test/static/valid_saml.xml", "utf-8"); const doc = new xmldom.DOMParser().parseFromString(xml); const sig = new SignedXml(); + sig.getCertFromKeyInfo = SignedXml.getCertFromKeyInfo sig.loadSignature(sig.findSignatures(doc)[0]); const validSignature = sig.checkSignature(xml); expect(validSignature).to.be.true; diff --git a/test/key-info-tests.spec.ts b/test/key-info-tests.spec.ts index 5e138e6..19c8f4a 100644 --- a/test/key-info-tests.spec.ts +++ b/test/key-info-tests.spec.ts @@ -13,7 +13,6 @@ describe("KeyInfo tests", function () { sig.publicCert = fs.readFileSync("./test/static/client_public.pem"); sig.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#"; sig.signatureAlgorithm = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; - sig.getKeyInfoContent = SignedXml.getKeyInfoContent; sig.computeSignature(xml); const signedXml = sig.getSignedXml(); const doc = new xmldom.DOMParser().parseFromString(signedXml); diff --git a/test/signature-unit-tests.spec.ts b/test/signature-unit-tests.spec.ts index bbb0c9f..0db89a4 100644 --- a/test/signature-unit-tests.spec.ts +++ b/test/signature-unit-tests.spec.ts @@ -534,7 +534,6 @@ describe("Signature unit tests", function () { sig.signatureAlgorithm = "http://dummySignatureAlgorithm"; sig.canonicalizationAlgorithm = "http://DummyCanonicalization"; sig.privateKey = ""; - sig.getKeyInfoContent = SignedXml.getKeyInfoContent; sig.addReference({ xpath: "//*[local-name(.)='x']", @@ -1237,7 +1236,6 @@ describe("Signature unit tests", function () { sig.publicCert = pemBuffer; sig.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#"; sig.signatureAlgorithm = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; - sig.getKeyInfoContent = SignedXml.getKeyInfoContent; sig.computeSignature(xml); const signedXml = sig.getSignedXml();