Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b0fecd8dcb
Fetching contributors…

Cannot retrieve contributors at this time

72 lines (48 sloc) 2.722 kb
Java DSS 1.0 Client
-------------------
This client allows the validation and update of XAdES 1.3.2 signatures. Currently works only with detached signatures.
It also allows the creation of XAdES 1.3.2 timestamp tokens over contents.
It requires Java 1.5 or above.
Installation
------------
This project has been structured using maven. A built jar has been provided on dist directory.
The project presents some dependencies on thrid party libs, those are:
DSSTypes for xmlbeans (dss-10-types.jar provided on the root dir of this project)
XmlBeans (xmlbeans from apache, version 2.2.0)
Apache Commons HTTPClient .- (commons-httpclient version 3.1)
Building
---------
+ Fast way :
You need to have maven installed, then simply use
mvn package -Dmaven.test.skip=true
+ Best way
This builds skipping test cases. To launch test cases you need to create a Tractis account and to generate an API Key at https://www.tractis.com/webservices/ .
Then go to credentials.properties and change user and pass attributes with the values of your API Key Identifier/Secret .
mvn package
Both processes would create a jar file dss10-1.0.jar under target dir containing all classes needed to invoke SVA or TSA services.
Usage
-----
This clients invokes a service that requires authentication.
To configure credentials just create a credentials.properties and make it available on the classpath.
Fill in this file with the user and pass recovered as the API key secret and pass from a TSA API Key created at https://www.tractis.com/webservices/tsa .
After this you can use the client as it follows:
Signature Validation and Update
-------------------------------
//Validation
DssClient client = new DssClient();
DSSResult validateSignature = client.validateSignature(signature, document);
ResultCode code = validateSignature.getResult();
//Update, includes signature, document and form to be updated to
DssClient client = new DssClient();
//Assuming signature() and document() methods are implemented and recover the signature and document as input streams
DSSResult updateResult = client.validateAndUpdateSignature(signature(), document(), "urn:oasis:names:tc:dss:1.0:profiles:AdES:forms:ES-T");
//To recover the updated signature
InputStream updatedSignature = updateResult.getUpdatedSignature();
//To recover the validation result
ResultCode code = updateResult.getResult();
Timestamp Creation
-------------------
//Recover the document to be stamped
InputStream document = document();
InputStream generateTimestamp = client.generateTimestamp(document);
System.out.println("Timestamp is " + new String(StreamUtils.getBytesFromStream(generateTimestamp)));
Jump to Line
Something went wrong with that request. Please try again.