Skip to content

Set getCertFromKeyInfo to noop #445

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/signed-xml.ts
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 3 additions & 0 deletions test/document-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 0 additions & 1 deletion test/key-info-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 0 additions & 2 deletions test/signature-unit-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -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();