Skip to content

Web of Needs - Implementation of the idea of PrivateRide and ACL in Java 8.

Notifications You must be signed in to change notification settings

researchstudio-sat/won_reputation_privacy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web of Needs - Privacy Preserving Reputation System

Implementation of the idea of PrivateRide in Java 8.

Web of Needs: Finding and cooperating with people. Protocol, not platform. Decentralized. Linked Data. Open Source.

Setup

  • Clone the Repo and import it into IntelliJ and import Maven Dependencies.
  • Make sure you "mvn install" WoN-Core of my fork
  • Reimport Maven dependencies

TODO: use Maven to build and test the Repo without IntelliJ

How to Use

msz.bakk.cmd.CmdApplication contains a main function. You can start the CLI tool here. Start the Application with the argument "SP" and the application acts like the service provider and initializes all the needed parameters.

There is a test class CmdApplicationTests which includes all tests and cases needed to perform a successful data exchange between 2 users and 1 SP and 4 users and 1 SP.

Spring Shell makes it easy to write CLI commands by just writing the method and annotate it with @ShellMethod. This way you can execute your command with the methods name.

IntelliJ: Start the CmdApplication and stop it right after to create a configuration template by IntelliJ. Edit the Configuration and copy it 4 times and name the configuration like this "Alice", "Bob", "Charlie", "Carol". The names are used for the shell indicator. But you need atleast one "SP" to work with. You also need to set only one program argument - the name of the user or "SP". Look at the Screenshots in /docs to get an idea. There are also screenshots from the tool itself and how to execute a command.

To get started with the exchange you need to do some pre-work. You need to create a certificate to "register" the client to the SP system. Look at CmdApplicationTests setUp().

Alice: publickey (returns public key in the shell - copy that)
SP: generatecertificate (insert here alice public key AND copy the output of the SP)
Alice: addcertificate (insert here the certificate generated by the SP)

These steps have to be done by every user to get a certificate for the Demo. In the webofneeds we already have the certificate/public key in the atoms, so this part is only meant for demo purpose.

See docs/reputationTokenMessage.txt how to use the output of the CLI tool for the WoN-Chat. Your message has to begin with
<this:eventuri> <https://w3id.org/won/ext/reputation#MESSAGETYPE> [
<CONTENT>
]

Message types are defined in docs/reputation.ttl as rep:subClassOf rep:Message

Alice, Bob, Charlie, Carol basic protocol commands:
genrandomhash
exchangehash <HASH>
verifyhashsignature <HASH from genrandomhash> blindreputationtokenmsg (just to get the WON-Message)
createexchangetokenmsg
rateuser <RATING in float> <MESSAGE String> <ENCODED reputation token> <ENCODED blinded token>

SP protocol:
blindsigntoken <ENCODED reputation token>
verify <ENCODED blinded token> <ENCODED reputation token>
rateuser <RATING in float> <MESSAGE String> <ENCODED reputation token> <ENCODED blinded token> <ORIGINAL hash from genrandomhash>

The Tool is supposed to act like a real implementation - so you do not have to copy and paste every single parameter. All parameters that are used before are stored into fields in the CLI object.

Tests

This work contains test-cases implemented with JUnit. These test classes provide an overview of how the implementation was implemented and how to use the individual classes. We provide tests with and without sockets.

Socket implementation are the prototype for the Won network. The tests without sockets can be used as a library.

The test class of the CLI tool is inside src/test/java/ structure. To test the CLI tool manually you can open up 3 terminal windows (alice, bob, SP).

Documentation

We simulate the Reputation-Token acquiring process with plain Java Sockets. This is a simple implementation of the Idea presented in PrivateRide and the prototype for the WoN.

In WoN we use so-called bots which can perform tasks on behalf of the user. eg. acquiring ACL-Tokens or Reputation-Tokens. These tokens are based on complex computation which should be hidden from the user. The only thing the user is interested being able to create an Atom or rate another User.

Theory: Reputation-Token

To see how the reputation token algorithm works between user, you can look at /src/test/java/WonProtocolE2ETest.java. In this test file we simulate the exchange of the reputation-tokens. Quick overview between the Users Bob and Alice: ``

  • Bob and Alice registers to the system to get a certificate (registerWithSystem)
  • They generate a random number and hash them (createRandomHash)
  • They exchange the random hashed number (exchangeHash)
  • They sign the random hashed number from the other person with their private key (signHash)
  • They create a ReputationToken which contains their certificate and the signed hashed number from the other person (createReputationToken)
  • They send this RepuationToken to the SP to get a blind Signature of the bytes of that token (blindAndSign)
  • They exchange the blind signed ReputationToken (exchangeReputationToken)
  • They send the ReputationToken along with the original Hash to the SP to verify it (verify)

Sockets

To simulate these Algorithms we created a prototype with plain Java Sockets /src/test/java/WonBotTest.java. The Test-Method is considerd be a Bot of a specific side. This is side is defined in the name. eg. runAlice means, we test Alice and test and method is Bob. runBob means, we test Bob and the method is Alice. runSP means, we test SP and the method is Bob or Alice. (it does not matter because Bob and Alice send the same data)

Blind Signature

To test blind signature over the network look at the Test-Method runSP_testBlindAndSign_valid() in WonBotTest.java We take the side of Alice (or Bob) and create a random hashed number. We send the random hashed number to the SP. The SP blinds it and signs with her private key and returns to Alice. In the next step we want to verify that blind signature. In the real Won we exchange the blind signature first and verify it afterwards.

Reputation Token

To test the exchange of Reputation Tokens look at runBob_testProtocol() in WonBotTest.java

TODO Github-wise

  • provide installation guide
  • how to test
  • how to use classes and functionality

About

Web of Needs - Implementation of the idea of PrivateRide and ACL in Java 8.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%