Skip to content

danubetech/data-integrity-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

data-integrity-java

Information

This library is a direct continuation of our earlier library ld-signatures-java.

It provides an implementation of the following cryptographic suites for Linked Data Proofs:

Maven

Build:

mvn clean install

Dependency:

<repositories>
	<repository>
		<id>danubetech-maven-public</id>
		<url>https://repo.danubetech.com/repository/maven-public/</url>
	</repository>
</repositories>

<dependency>
	<groupId>com.danubetech</groupId>
	<artifactId>data-integrity-java</artifactId>
	<version>1.21-SNAPSHOT</version>
</dependency>

Example

Example JSON-LD document:

{
	"@context": {
		"schema": "http://schema.org/",
		"name": "schema:name",
		"homepage": "schema:url",
		"image": "schema:image"
	},
	"name": "Manu Sporny",
	"homepage": "https://manu.sporny.org/",
	"image": "https://manu.sporny.org/images/manu.png"
}

Example code:

JsonLDObject jsonLdObject = JsonLDObject.fromJson(new FileReader("input.jsonld"));

byte[] testEd25519PrivateKey = Hex.decodeHex("984b589e121040156838303f107e13150be4a80fc5088ccba0b0bdc9b1d89090de8777a28f8da1a74e7a13090ed974d879bf692d001cddee16e4cc9f84b60580".toCharArray());

Ed25519Signature2018LdSigner signer = new Ed25519Signature2018LdSigner(testEd25519PrivateKey);
signer.setCreated(new Date());
signer.setProofPurpose(LDSecurityKeywords.JSONLD_TERM_ASSERTIONMETHOD);
signer.setVerificationMethod(URI.create("https://example.com/jdoe/keys/1"));
signer.setDomain("example.com");
signer.setNonce("343s$FSFDa-");
LdProof dataIntegrityProof = signer.sign(jsonLdObject);

System.out.println(jsonLdObject.toJson(true));

Example Linked Data Proof:

{
    "type": "Ed25519Signature2018",
    "created": "2020-10-15T09:42:46Z",
    "domain": "example.com",
    "nonce" : "343s$FSFDa-",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "https://example.com/jdoe/keys/1",
    "jws": "eyJiNjQiOmZhbHNlLCJjcml0IjpbImI2NCJdLCJhbGciOiJFZERTQSJ9..8sFJcDtO_pYLjIkJNKfIOL3IOgm_bpbOqqr8ha0ZDa-e6XorbywVQmFCATNXPqMV10deru-zajF79tVelKo-Bw"
}

About

Danube Tech - https://danubetech.com/

Originally built during Rebooting Web-of-Trust in Paris on April 21st 2017.


This software library is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 871932

About

Java implementation of Data Integrity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages