Skip to content

CypherPoker: Core Cryptographic Operations

Patrick Bay edited this page Jun 13, 2019 · 9 revisions

This section describes generic cryptographic operations extended from the "Mental Poker" protocol by Shamir, Rivest, and Adleman (SRA).

Note

The deciding factor in what constitutes a completed "activity", as used below, is the point in the process when cryptographic verification may take place. This is determined in the protocol implementation.

Key Generation

In most activity transactions the crypto key pair, K, is kept private. It is released publicly once the activity has fully completed and requires verification. Multiple K such as may be generated during re-keying operations are stored in a key chain, KC.

  1. At or before activity startup a group crypto byte length, CB, is determined for subsequent operations. The CB length is the baseline value of desired cryptographic security, performance, and host environment support**.

  2. A random CB-length prime integer, P, is generated using an efficient method by the activity leader. This value is shared with all participants for subsequent operations.

  3. Each participant generates a private random asymmetric crypto key pair, K, consisting of two key halves KE and KD:

    a) KE is calculated by generating a random CB-length integer, testing it for validity, and repeating if the test fails. KE is valid if gcd (KE, phi(P))=1, where phi is Euler's totient function (equivalent to P-1 since P is prime) and gcd is the greatest common divisor function.

    b) KD is calculated as the modular multiplicative inverse of KE.

    ** This means a trade-off between security and performance and the limitations of the host environment (device hardware, operating system, etc.)

Token Generation

Tokens are the operational values in activities such as the cards in card games. To address the "leaky cards" problem identified by Don Coppersmith, only CB-length quadratic residues mod P are used as plaintext values, thereby ensuring that encrypted values are also quadratic residues mod P.

  1. A plaintext token, TP, is generated by calculating the Legendre symbol of a CB-length integer such that TP mod P is a quadratic residue. TP must be greater than 0 and less than P.

  2. A token is encrypted by calculating TP^KE mod P, where ^ denotes exponentiation. The resulting encrypted token is TE. This satisfies the property that independent encryption functions FE1 and FE2 be commutative such that FE1(FE2(TP)) = FE2(FE1(TP)).

  3. A token is decrypted by calculating TE^KD mod P. This satisfies the property that independent decryption functions DE1 and DE2 be commutative such that DE1(DE2(TE)) = DE2(DE1(TE)).

In the current implementation, quadratic non-residues mod P are discarded.

Clone this wiki locally