Skip to content

Commit f8cbbb7

Browse files
Chore: Update README.md (#432)
1 parent 5a0d317 commit f8cbbb7

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ When signing a xml document you can pass the following options to the `SignedXml
5757

5858
- `privateKey` - **[required]** a `Buffer` or pem encoded `String` containing your private key
5959
- `publicCert` - **[optional]** a `Buffer` or pem encoded `String` containing your public key
60-
- `signatureAlgorithm` - **[optional]** one of the supported [signature algorithms](#signature-algorithms). Ex: `sign.signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"`
61-
- `canonicalizationAlgorithm` - **[optional]** one of the supported [canonicalization algorithms](#canonicalization-and-transformation-algorithms). Ex: `sign.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"`
60+
- `signatureAlgorithm` - **[required]** one of the supported [signature algorithms](#signature-algorithms). Ex: `sign.signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"`
61+
- `canonicalizationAlgorithm` - **[required]** one of the supported [canonicalization algorithms](#canonicalization-and-transformation-algorithms). Ex: `sign.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"`
6262

6363
Use this code:
6464

@@ -106,7 +106,24 @@ The result will be:
106106

107107
Note:
108108

109-
If you set the `publicCert` property, a `<X509Data></X509Data>` element with the public certificate will be generated in the signature.
109+
If you set the `publicCert` and the `getKeyInfoContent` properties, a `<KeyInfo></KeyInfo>` element with the public certificate will be generated in the signature:
110+
111+
```xml
112+
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
113+
<SignedInfo>
114+
...[signature info removed]...
115+
</SignedInfo>
116+
<SignatureValue>vhWzpQyIYuncHUZV9W...[long base64 removed]...</SignatureValue>
117+
<KeyInfo>
118+
<X509Data>
119+
<X509Certificate>MIIGYjCCBJagACCBN...[long base64 removed]...</X509Certificate>
120+
</X509Data>
121+
</KeyInfo>
122+
</Signature>
123+
```
124+
125+
For `getKeyInfoContent`, a default implementation `SignedXml.getKeyInfoContent` is available.
126+
110127
To customize this see [customizing algorithms](#customizing-algorithms) for an example.
111128

112129
## Verifying Xml documents

0 commit comments

Comments
 (0)