Skip to content

Commit

Permalink
add test for encrypted private key
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Novak committed Apr 16, 2024
1 parent 08ff45f commit 9717c2e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/signature-unit-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1265,4 +1265,14 @@ describe("Signature unit tests", function () {
"MIIDZ",
);
});

it("can decrypt the private key when privateKeyPass is set", function () {
const xml = "<root><x /></root>";
const sig = new SignedXml();
sig.privateKey = fs.readFileSync("./test/static/client_encrypted.pem");
sig.privateKeyPass = "password";
sig.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#";
sig.signatureAlgorithm = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
expect(() => sig.computeSignature(xml)).to.not.throw();
});
});

0 comments on commit 9717c2e

Please sign in to comment.