Sign and verify XML digital signatures from the command-line

The XML ValidatorBuddy software package also includes a command line tool. The name of the executable is “valbuddy.exe” and the tool is also located in the standard installation folder of XML ValidatorBuddy.

This command-line tool also supports sign and verify operations for multiple XML documents as a batch task. A sample settings XML to run a sign task would be:

<?xml version="1.0" encoding="UTF-8"?>
<batch_settings>
  <batch_units>
    <log_document path="D:\Documents\xml\sign_sampleprojects_log.xml"/>
    <options notify_finish="false" omit_results="false" omit_time="false" run_as_test="false" save_logdoc="true" timeout="-1" use_xmldate_format="true"/>
    <batch_unit output_folder="D:\Documents\xml\Sample Projects signed" overwrite="true" type="dsigsign">
      <folder_settings folder="D:\Documents\xml\Sample Projects" subfolders="true"/>
      <file_extensions>
        <extension>xml</extension>
      </file_extensions>
      <parameters add_keyinfo="true" add_keyname="false" add_x509data="true" canonicalization="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" certificate_name="xmlbuddy" digest="" hash="" output_postfix="_signed" sign="all" signature_type="enveloped">
        <transformations/>
      </parameters>
    </batch_unit>
  </batch_units>
</batch_settings>

During the batch task a log document is created at D:\Documents\xml\sign_sampleprojects_log.xml. This log contains the results for all documents from the source folder.

And to run a verify operation on a complete folder the configuration XML would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<batch_settings>
  <batch_units>
    <log_document path="D:\Documents\xml\verify_sampleprojects_log.xml"/>
    <options notify_finish="false" omit_results="false" omit_time="false" run_as_test="false" save_logdoc="true" timeout="-1" use_xmldate_format="true"/>
    <batch_unit type="dsigverify">
      <folder_settings folder="D:\Documents\xml\Sample Projects signed" subfolders="true"/>
      <file_extensions>
        <extension>xml</extension>
      </file_extensions>
      <parameters certificate_name="xmlbuddy"/>
    </batch_unit>
  </batch_units>
</batch_settings>

In order to use any certificate please add it to the XML ValidatorBuddy desktop application using the Options dialog and specify a name for it. The examples above are using the “xmlbuddy” test certificate specified by the following attribute: certificate_name=”xmlbuddy”.

»crosslinked«

Leave a Reply