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
An xml digital signature library for node. Xml encryption is coming soon. Written in pure javascript!
6
+
---
7
7
8
-
For more information visit [my blog](http://webservices20.blogspot.com/) or [my twitter](https://twitter.com/YaronNaveh).
8
+
# Upgrading
9
+
10
+
The `.getReferences()` AND the `.references` APIs are deprecated.
11
+
Please do not attempt to access them. The content in them should be treated as unsigned.
12
+
13
+
Instead, we strongly encourage users to migrate to the `.getSignedReferences()` API. See the [Verifying XML document](#verifying-xml-documents) section
14
+
We understand that this may take a lot of efforts to migrate, feel free to ask for help.
15
+
This will help prevent future XML signature wrapping attacks.
16
+
17
+
---
9
18
10
19
## Install
11
20
@@ -161,6 +170,11 @@ var select = require("xml-crypto").xpath,
161
170
var xml =fs.readFileSync("signed.xml").toString();
162
171
var doc =newdom().parseFromString(xml);
163
172
173
+
// DO NOT attempt to parse whatever data object you have here in `doc`
174
+
// and then use it to verify the signature. This can lead to security issues.
175
+
// i.e. BAD: parseAssertion(doc),
176
+
// good: see below
177
+
164
178
var signature =select(
165
179
doc,
166
180
"//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']",
@@ -177,39 +191,21 @@ try {
177
191
In order to protect from some attacks we must check the content we want to use is the one that has been signed:
* Contains the canonicalized XML of the references that were validly signed.
77
+
*
78
+
* This populates with the canonical XML of the reference only after
79
+
* verifying the signature is cryptographically authentic.
80
+
*/
81
+
privatesignedReferences: string[]=[];
82
+
74
83
/**
75
84
* To add a new transformation algorithm create a new class that implements the {@link TransformationAlgorithm} interface, and register it here. More info: {@link https://github.com/node-saml/xml-crypto#customizing-algorithms|Customizing Algorithms}
* To add a new hash algorithm create a new class that implements the {@link HashAlgorithm} interface, and register it here. More info: {@link https://github.com/node-saml/xml-crypto#customizing-algorithms|Customizing Algorithms}
* To add a new signature algorithm create a new class that implements the {@link SignatureAlgorithm} interface, and register it here. More info: {@link https://github.com/node-saml/xml-crypto#customizing-algorithms|Customizing Algorithms}
0 commit comments