Skip to content
use cases for coherence cryptoserver
Branch: master
Clone or download
Latest commit 194a810 May 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
auth Delete Tutorial.txt Dec 27, 2018
auth2 Update README.md May 16, 2019
db_enc Delete gcm.py Apr 14, 2019
file_sign Add files via upload Apr 14, 2019
nocallbackhell Add files via upload May 16, 2019
offload Add files via upload Apr 14, 2019
proxy Add files via upload Apr 14, 2019
README.md Update README.md May 16, 2019

README.md

Coherence PoC

Proof of concept for Coherence

  • Coherence needs to be up and runnig on 127.0.0.1:6613 link
  • Install node js link

Auth

This program create an user and check de user's credentials using Whirpool and Argon2.

cd auth
npm install
node index.js

Go to your web browser http://127.0.0.1:6845/login.html

DB encryption

db_enc

#1 Symmetric encryption

  • Create key/iv for Serpent, read passport_data.csv, encrypt each row with Serpent
python db_encrypt.py

db: passport_enc


#2 Symmetric json encryption

  • Create key/iv for Serpent, read passport_data.csv, create a json string from passport_data.csv , encrypt each json string with Serpent
 python db_encrypt_json.py

Result:

Key cipher: 
{"result": "35FF660C9754D5B4840ACBD91A1A5C1E524BE2BAE35D73625812C8929E702BEB", "algorithm": "RAND_RP", "error": ""}

Iv cipher: 
{"result": "2185B990C8E25CDE790A45A6014B1883", "algorithm": "RAND_RP", "error": ""}

key and iv need to substitute in db_encrypt_json.py

python db_encrypt_json_select.py

db: passport_enc_js


#3 Hybrid(Symmetric with Asymmetric) json encryption

  • Create a key secp256k1 , read passport_data.csv, create a json string from passport_data.csv , encrypt each json string with Serpent and encrypt key/iv with secp256k1
python db_ecc.py

Result:

{"pubkey": 
"3056301006072A8648CE3D020106052B8104000A034200049F1B914EC08D0577EA026035058D844D813E8E5395E47E53E5595A9AD2B789EFE4BEF8AB1AD2BF3068C813F4FF02E103BAF0A3DAA90E3B1FCA79B5A630AE707C", 
"error": "", "curve": "secp256k1", "algorithm": "ECC_GEN", "privkey": 
"303E020100301006072A8648CE3D020106052B8104000A042730250201010420B976160F9E1EA23DEA666756F089DDFCED2444FBE439E0255BCA9EA70E584C3E"}

pubkey and privkey need to substitute in db_ecc_select.py

python db_ecc_select.py

db: passport_ecc


#4 Searching with HMAC

  • This example use hmac to search on example 3 (encrypted database)
python db_ecc_hmac.py

Result

E951AC9CC8BE1C89A8BBE3230076586B1DC3E7A113D970BCEFE8FD61BD3E1F2C

this needs to substitute in db_ecc_hmac_select.py and db_ecc_hmac_search_select.py

from 3 privkey and pubkey need to be substituted in db_ecc_hmac_search_select.py

python db_ecc_hmac_select.py
python db_ecc_hmac_search_select.py

db: passport_hmac, passport_ecc


File Sign

  • This program sign a file with a a kind of json web signature and verofy it.
cd  file_sign
npm install
node file_sign.js

Go to your web browser http://127.0.0.1:6845/


Offloading

  • This program offload the creation of 1024 bits RSA key.
cd offload
npm install
node index.js

Proxy

  • This program implements an access control
cd proxy
npm install
python init-keys.py
python init-jws.py
python create-usr.py
node proxy-ws.js

Substitute the user created in client-ws.py (str_auth)

python client-ws.py

nocallbackhell

  • This program shows how to avoid callback hell when you work with Coherence.
cd nocallbackhell
npm install 
node tcp.js
You can’t perform that action at this time.