TOOLS: Container Creator
The objective of this document is to explain in short how to use the tool included in package containerCreator_v0.3_3 that can be used to create a container according to the CWA2 specification “Metadata container”.
Note these tools are part of a proof of concept, and still are in alpha state. These tools are provided “AS IS”, without warranty of any kind.
Restrictions
The tool restricts the container creation to one container at a time. The recursive usage of the tool (creating containers containing other containers) is not automated by the tool API but may be realized by other means if necessary.
Despite the flexible container structure defined in the CWA2 metadata container specification, this tool is only able to apply one single (or no) encryption and one single (or no) signature, and furthermore enforces the following processing order for the container: “encryption(signature(zip-file))”.
The tool is only able to create header structures complying with the BasicHeader schema. Extended headers may still be used by providing a header template for the tool. Extended headers shall comply with the rules provided in the CWA2 specification document.
Download the container creator executable file containerCreatorTool_v0.3_3 . Download the CWA2 test data material CWA2TestData_v0.3_3.
Prerequisites:
Before using this tool, you need:
- Java: If Java SE (Standard Edition) is not installed on your computer, download from oracle and install it. This package has been tested with java version 1.6.0, so this version or a newer one should be fine. If Java SE is installed on your computer, verify version (by using “java –version”), and if needed download and install a newer one;
- Package containerCreatorTool_v0.3_3.jar;
- Package headerCreatorTool_v0.3_3.jar;
- Package compressionTools_v0.3.jar;
- If the usage of signatures is required: Package signtools_0_3_0.jar, see additional prerequisites in section “TOOLS: Signature Creation and Validation”;
- If the usage of encryption is required: Package cryptTools_0_3_1.jar, see additional prerequisites in section “TOOLS: Encryption and Decryption”.
- Internet access to acquire the header XML schema for validation (if referring to a schema online)
Creation of a container: containerCreator.ContainerCreator
To create a container, use the command:
java.exe –classpath compressionTools_v0.3.jar;headerCreatorTool_v0.3_3.jar;containerCreatorTool_v0.3_3.jar containerCreator.ContainerCreator -c containerdirectory -d datadirectory -o outputdirectory –r responseflag -cid containerID -h headertemplate -k filename -p password -ce alias -os alias
Where:
- -c containerdirectory: file path in which the content of the pure container structure will be collected
- -d datadirectory: file path in which data instances (to be included into the container and its header) reside. Multiple (comma-separated) directories are possible.
- -o outputdirectory: Output directory in which the container will be generated
- -r responseflag: in case of the creation of a submission container, this flag shall not be set and a header file will be generated. In case of the creation of a response container, this flag shall be set and no header file will be generated
- -cid containerID: an identifier for the container report data context
- -h headertemplate: file path in which the header template document resides. The header.xml document is fully specified in the CWA2 documentation. The header document can only be validated if the location of the XML schema is given in the “xsi:schemaLocation” attribute of the template header. If the header template is not provided, a header complying with the BasicHeaderOnly schema will be generated instead.
- -k filename: file path in which the java key store resides (to be used only if encryption/electronic signatures are applied)
- -p password: a password for accessing the java key store (to be used only if encryption/electronic signatures are applied)
- -ce alias: counterpart encryption alias (to be used only if encryption/electronic signatures are applied)
- -os alias: own private key alias (to be used only if encryption/electronic signatures are applied)
The basic functionalities of the container creator tool can be divided in five parts:
- aggregation,
- header creation
- compression,
- electronic signature and
- encryption.
All of these can be performed at once with the container creator tool however the application of electronic signature and encryption is optional. The header creation tool, compression, signature and the encryption tools can also be used as standalone tools.
Aggregation
This tool aggregates the contents from the various input directories given as parameter (datadirectory). The tool shall create similar directory structures as found in the input directories into the directory location “containerdirectory” where it shall also create a file called “header.xml”. All static field entries are copied from a template header xml file found at the location “headertemplate”. The tool generates the file (<File>) listings for the header.xml (see example below) according to the data aggregated to the “containerdirectory”.
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?><BasicHeaderOnly xmlns=”http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeaderOnly” xmlns:bh=”http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeader” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeaderOnly http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeaderOnly.xsd”>
<bh:ReportDataContext>
<bh:ReportReferenceID>TestID</bh:ReportReferenceID>
</bh:ReportDataContext>
<bh:File>
<bh:FilePath>dataInstances_1/dataInstances_1_2/t-kri-corep-ca-2006-07-01_2.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/dataInstances_1_2/t-kri-corep-ci-2006-07-01_2.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/dataInstances_1_2/t-kri-corep-cs-2006-07-01_2.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/t-kri-corep-ca-2006-07-01.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/t-kri-corep-ci-2006-07-01.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/t-kri-corep-cs-2006-07-01.xbrl</bh:FilePath>
</bh:File>
</BasicHeaderOnly>
Header creation
See section “TOOLS: Header Creation”.
Compression
See section “TOOLS: Compression”.
Signature
See section “TOOLS: Signature Creation and Validation”.
Encryption
See ” TOOLS: Encryption and Decryption”.
Sample command 1
Creation of a signed and encrypted container:
- data directory C:\CWA2TestData_v0.3_3\containerCreator\in\xbrlReports,C:\CWA2TestData_v0.3_3\containerCreator\in\excelReports
- signature applied (key alias “declarer1”)
- encryption applied (key alias “nsa”)
- creates pure contents structure to C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir, a compressed container, signed container and an encrypted container to C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSignedEncrypted
“C:\Program Files\Java\jdk1.7.0_04\bin\java.exe” -server -classpath commons-logging-1.1.1.jar;cryptTools_0_3_1.jar;bcprov-jdk15on-149.jar;serializer-2.7.1.jar;xalan-2.7.1.jar;xercesImpl-2.9.1.jar;xml-apis-1.3.04.jar;xmlsec-1.5.4.jar;signtools_0_3_0.jar;compressionTools_v0.3.jar;headerCreatorTool_v0.3_3.jar;containerCreatorTool_v0.3_3.jar containerCreatorTool.ContainerCreator -cid testID -d C:\CWA2TestData_v0.3_3\containerCreator\in\xbrlReports,C:\CWA2TestData_v0.3_3\containerCreator\in\excelReports -o C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSignedEncrypted -c C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir -os declarer1 -ce nsa -k C:\allJKS.jks -p XBRL2013 -h C:\CWA2TestData_v0.3_3\headertemplate.xml
Sample output 1
dec 08, 2013 1:16:17 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Creating a submission container…
dec 08, 2013 1:16:17 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory dataInstances_1_2 succesfully retrieved to container directory.
dec 08, 2013 1:16:17 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory xbrlReports succesfully retrieved to container directory.
dec 08, 2013 1:16:17 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory excelReports succesfully retrieved to container directory.
dec 08, 2013 1:16:22 PM. xmlTools.XMLTools validateXML
INFO: file:/C:/CWA2TestData_v0.3_3/headertemplate.xml is valid.
dec 08, 2013 1:16:22 PM. xmlTools.XMLTools writeXml
INFO: header.xml created successfully at C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir\header.xml
dec 08, 2013 1:16:22 PM. headerCreatorTool.HeaderCreatorUtil doHeaderCreation
INFO: Header document successfully created at C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir
dec 08, 2013 1:16:22 PM. compressionTools.ZipFileUtil doZipFile
INFO: Compressed file C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSignedEncrypted\containerDir.zip created.
dec 08, 2013 1:16:22 PM. signtools.SignFile generateDsigEnveloping
INFO: Signature created at C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSignedEncrypted\containerDir.signed.xml.
dec 08, 2013 1:16:23 PM. cypher.EncryptFile outputDocToFile
INFO: Wrote document containing encrypted data to file:/C:/CWA2TestData_v0.3_3/containerCreator/out/zippedSignedEncrypted/containerDir.encrypted.xml
dec 08, 2013 1:16:23 PM. containerCreatorTool.ContainerCreator main
INFO: Container created in 5729 milliseconds
Sample command 2
Creation of a signed container:
- data directory C:\CWA2TestData_v0.3_3\containerCreator\in\xbrlReports,C:\CWA2TestData_v0.3_3\containerCreator\in\excelReports
- signature applied (key alias “declarer1”)
- no encryption applied
- creates pure container structure to C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir, a compressed container and a signed container to C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSigned
“C:\Program Files\Java\jdk1.7.0_04\bin\java.exe” -server -classpath signtools_0_3_0.jar;compressionTools_v0.3.jar;headerCreatorTool_v0.3_3.jar;containerCreatorTool_v0.3_3.jar containerCreatorTool.ContainerCreator -h C:\CWA2TestData_v0.3_3\headertemplate.xml -d C:\CWA2TestData_v0.3_3\containerCreator\in\xbrlReports,C:\CWA2TestData_v0.3_3\containerCreator\in\excelReports -o C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSigned -c C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir -os declarer1 -k C:\allJKS.jks -p XBRL2013 -cid testID2
Sample output 2
dec 08, 2013 1:54:21 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Creating a submission container…
dec 08, 2013 1:54:21 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Parameter -ce for counterpart encryption not in use, encryption shall not be applied. Use: -ce alias
dec 08, 2013 1:54:21 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory dataInstances_1_2 succesfully retrieved to container directory.
dec 08, 2013 1:54:21 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory xbrlReports succesfully retrieved to container directory.
dec 08, 2013 1:54:21 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory excelReports succesfully retrieved to container directory.
dec 08, 2013 1:54:22 PM. xmlTools.XMLTools validateXML
INFO: file:/C:/CWA2TestData_v0.3_3/headertemplate.xml is valid.
dec 08, 2013 1:54:22 PM. xmlTools.XMLTools writeXml
INFO: header.xml created successfully at C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir\header.xml
dec 08, 2013 1:54:22 PM. headerCreatorTool.HeaderCreatorUtil doHeaderCreation
INFO: Header document successfully created at C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir
dec 08, 2013 1:54:22 PM. compressionTools.ZipFileUtil doZipFile
INFO: Compressed file C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSigned\containerDir.zip created.
dec 08, 2013 1:54:22 PM. signtools.SignFile generateDsigEnveloping
INFO: Signature created at C:\CWA2TestData_v0.3_3\containerCreator\out\zippedSigned\containerDir.signed.xml.
dec 08, 2013 1:54:22 PM. containerCreatorTool.ContainerCreator launch
INFO: Encryption not applied for container.
dec 08, 2013 1:54:22 PM. containerCreatorTool.ContainerCreator main
INFO: Container created in 1793 milliseconds
Sample command 3
Creation of a compressed-only container:
- data directory C:\CWA2TestData_v0.3_3\containerCreator\in\xbrlReports,C:\CWA2TestData_v0.3_3\containerCreator\in\excelReports
- no signature applied
- no encryption applied
- creates pure container structure to C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir, a compressed C:\CWA2TestData_v0.3_3\containerCreator\out\zipped
“C:\Program Files\Java\jdk1.7.0_04\bin\java.exe” -server -classpath compressionTools_v0.3.jar;headerCreatorTool_v0.3_3.jar;containerCreatorTool_v0.3_3.jar containerCreatorTool.ContainerCreator -h C:\CWA2TestData_v0.3_3\headertemplate.xml -d C:\CWA2TestData_v0.3_3\containerCreator\in\xbrlReports,C:\CWA2TestData_v0.3_3\containerCreator\in\excelReports -o C:\CWA2TestData_v0.3_3\containerCreator\out\zipped -c C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir -cid testID3
Sample output 3
dec 08, 2013 1:56:01 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Creating a submission container…
dec 08, 2013 1:56:01 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Parameter -ce for counterpart encryption not in use, encryption shall not be applied. Use: -ce alias
dec 08, 2013 1:56:01 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Parameter -os for own signature not in use, signature shall not be applied. Use: -os alias
dec 08, 2013 1:56:01 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory dataInstances_1_2 succesfully retrieved to container directory.
dec 08, 2013 1:56:01 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory xbrlReports succesfully retrieved to container directory.
dec 08, 2013 1:56:01 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory excelReports succesfully retrieved to container directory.
dec 08, 2013 1:56:03 PM. xmlTools.XMLTools validateXML
INFO: file:/C:/CWA2TestData_v0.3_3/headertemplate.xml is valid.
dec 08, 2013 1:56:03 PM. xmlTools.XMLTools writeXml
INFO: header.xml created successfully at C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir\header.xml
dec 08, 2013 1:56:03 PM. headerCreatorTool.HeaderCreatorUtil doHeaderCreation
INFO: Header document successfully created at C:\CWA2TestData_v0.3_3\containerCreator\out\containerDir
dec 08, 2013 1:56:03 PM. compressionTools.ZipFileUtil doZipFile
INFO: Compressed file C:\CWA2TestData_v0.3_3\containerCreator\out\zipped\containerDir.zip created.
dec 08, 2013 1:56:03 PM. containerCreatorTool.ContainerCreator launch
INFO: Signature/Encryption not applied for the container.
dec 08, 2013 1:56:03 PM. containerCreatorTool.ContainerCreator main
INFO: Container created in 1778 milliseconds
Sample command 4
Creation of a response container:
- data directory C:\CWA2TestData_v0.3_3\containerCreator\in\feedbackInstances
- no signature applied
- no encryption applied
- creates pure container structure without the header.xml file to C:\CWA2TestData_v0.3_3\containerCreator\out\containerDirFeedback, a compressed container to C:\CWA2TestData_v0.3_3\containerCreator\out\response
“C:\Program Files\Java\jdk1.7.0_04\bin\java.exe” -server -classpath compressionTools_v0.3.jar;headerCreatorTool_v0.3_3.jar;containerCreatorTool_v0.3_3.jar containerCreatorTool.ContainerCreator -d C:\CWA2TestData_v0.3_3\containerCreator\in\feedbackInstances -r true -o C:\CWA2TestData_v0.3_3\containerCreator\out\response -c C:\CWA2TestData_v0.3_3\containerCreator\out\containerDirFeedback -cid testID4
Sample output 4
dec 08, 2013 1:57:34 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Creating a response container…
dec 08, 2013 1:57:34 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Parameter -ce for counterpart encryption not in use, encryption shall not be applied. Use: -ce alias
dec 08, 2013 1:57:34 PM. containerCreatorTool.ContainerCreator checkArgs
INFO: Parameter -os for own signature not in use, signature shall not be applied. Use: -os alias
dec 08, 2013 1:57:34 PM. containerCreatorTool.ContainerCreator copyDirectory
INFO: Documents from directory feedbackInstances succesfully retrieved to container directory.
dec 08, 2013 1:57:34 PM. compressionTools.ZipFileUtil doZipFile
INFO: Compressed file C:\CWA2TestData_v0.3_3\containerCreator\out\response\containerDirFeedback.zip created.
dec 08, 2013 1:57:34 PM. containerCreatorTool.ContainerCreator launch
INFO: Signature/Encryption not applied for the container.
dec 08, 2013 1:57:34 PM. containerCreatorTool.ContainerCreator main
INFO: Container created in 91 milliseconds