Code Monkey home page Code Monkey logo

secure_dice's Introduction

Prerequisites and System Specifications

Python 3 (I use 3.11.0)

Bash (I use Git Bash)

OpenSSL (Included)

I am running on an x64 cpu, running Windows 10 Build 19044

Running the Solution

From the root of the repository, run the following commands:

$ ./generatekeys.sh

$ ./alice.py

$ ./bob.py

The Protocol

It is assumed that Bob and Alice have access to the following files: shared.py, alice.tls.cert.pem, bob.tls.cert.pem. It is assumed that only Alice has access to alice.py and alice.tls.key.pem. It is assumed that only Bob has access to bob.py and bob.tls.key.pem. After the environment is set-up, neither openssl.exe nor generatekeys.sh is needed.

Bob and Alice use TLS to communicate as implemented by the python ssl and socket libraries. TLS is used to guarantee confidentiality and integrity. Availability is limited in the sense that neither Alice nor Bob have ways of preventing all attacks, for example Denial of Service. To ensure that both parties have agency in the dice roll, Pedersen Commitments are used with the group of integers in the range [1..q] to the power of p mod q, where p and q are primes. In this example p and q have been generated as 16-bit primes due to inefficient algorithms otherwise slowing the program down significantly. This can be improved by re-generating with a call to generate_prime(n). Both roll a die in the range [1..6], the final die roll is given by computing ((roll1 + roll2) % 6) + 1

The protocol order and high-level execution of the implementation is as follows: Alice opens a port for Bob -> Bob connects with a valid certificate, otherwise disconnect -> Alice rolls and commits, sending commit to Bob -> Bob rolls and commits, sending commit to Alice -> Alice sends roll and r to Bob -> Bob sends roll and r to Alice -> They both verify the commit and agree on a dice roll.

secure_dice's People

Contributors

simonlk1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.