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
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -261,6 +261,7 @@ The `SignedXml` constructor provides an abstraction for sign and verify xml docu
261
261
-`keyInfoAttributes` - object - default `{}` - a hash of attributes and values `attrName: value` to add to the KeyInfo node
262
262
-`getKeyInfoContent` - function - default `noop` - a function that returns the content of the KeyInfo node
263
263
-`getCertFromKeyInfo` - function - default `SignedXml.getCertFromKeyInfo` - a function that returns the certificate from the `<KeyInfo />` node
264
+
-`getObjectContent` - function - default `noop` - a function that returns the content of the `<Object/>` nodes
264
265
265
266
#### API
266
267
@@ -272,6 +273,7 @@ To sign xml documents:
272
273
-`xpath` - a string containing a XPath expression referencing a xml element
273
274
-`transforms` - an array of [transform algorithms](#canonicalization-and-transformation-algorithms), the referenced element will be transformed for each value in the array
274
275
-`digestAlgorithm` - one of the supported [hashing algorithms](#hashing-algorithms)
276
+
-`isSignatureReference` - boolean - default `false` - indicates whether the target of this reference is located inside the `<Signature>` element (e.g. an `<Object>`)
275
277
-`computeSignature(xml, [options])` - compute the signature of the given xml where:
276
278
-`xml` - a string containing a xml document
277
279
-`options` - an object with the following properties:
@@ -534,6 +536,44 @@ sig.computeSignature(xml, {
534
536
});
535
537
```
536
538
539
+
### how to add custom Objects to the signature
540
+
541
+
Use the `getObjectContent` option when creating a SignedXml instance to add custom Objects to the signature. You can also reference these Objects in your signature by setting `isSignatureReference` to `true` when adding a reference.
542
+
543
+
```javascript
544
+
var SignedXml =require("xml-crypto").SignedXml,
545
+
fs =require("fs");
546
+
547
+
var xml ="<library>"+"<book>"+"<name>Harry Potter</name>"+"</book>"+"</library>";
0 commit comments