Api XML signature
XML files can be signed to prove their integrity. For signing XML files, you need a certificate and private key.
The different APIs available are below. The Syracuse module name (first parameter of ASYRWEBSER.EXEC_JS) is syracuse-xml/lib/helpers
.
Sign XML data | Verify XML data | Sign XML file | Verify XML file | test whether certificate with given name exists |
This function signes the XML data and returns the signed XML data. Function name: sign
.
There is a callback parameter at first position.
Code | Type and dimension | Contents |
---|---|---|
XML | Char | XML data |
PATH | Value Array of Char. | List of xpath expressions of parts of XML which should be signed (entry with empty string will sign the whole XML data) |
CERTIFICATE | Char. | name of certificate in certificate entity (must be certificate with private key) |
OPTIONS | Char. | Options. Must have JSON structure of Object with information:
|
This function reads the XML data in a file and writes the signed data to a file. You have to specify the folder name in the options unless you want to access files from Syracuse server. Function name: signfile
.
There is a callback parameter at first position.
Code | Type and dimension | Contents |
---|---|---|
XMLFILE | Char | absolute path of XML file |
XMLOUTFILE | Char | absolute path of signed XML file which is created. May be equal to path in XMLFILE |
PATH | Value Array of Char. | List of xpath expressions of parts of XML which should be signed (entry with empty string will sign the whole XML data) |
CERTIFICATE | Char. | name of certificate in certificate entity (must be certificate with private key) |
OPTIONS | Char. | Options. Must have JSON structure of Object with information:
|
This function verifies given XML string. It returns an array of verification errors. When the array is empty, verification is OK. Function name: verify
.
There is a callback parameter at first position.
Code | Type and dimension | Contents |
---|---|---|
XML | Char | XML data |
NAME | Char. | Name of certificate in certificate entity. |
OPTIONS | Char. | Options. Must have JSON structure of Object with information (should not be necessary at all):
|
This function verifies given XML data in a file. It returns an array of verification errors. When the array is empty, verification is OK.
You have to specify the folder name in the options unless you want to access files from Syracuse server. Function name: verifyfile
.
There is a callback parameter at first position.
Code | Type and dimension | Contents |
---|---|---|
XMLFILE | Char | absolute path of file with XML data |
NAME | Char. | Name of certificate in certificate entity. |
OPTIONS | Char. | Options. Must have JSON structure of Object with information:
|
This function looks into the certificate entity and looks whether there is a certificate with the given name. It may also be searched for a certificate with private key. Return value: true, when certificate exists. Function name: certificateExists
.
There is a callback parameter at first position.
Code | Type and dimension | Contents |
---|---|---|
NAME | Char. | Name of certificate in certificate entity. |
WITHKEY | Boolean | When true, it searches for a certificate with private key |