Microsoft Goes Open Source For The Next Generation of The Internet

Our data world is so 1980s! The Marriott hack shows us that we are often sloppy with our handling of citizen data, and things need to…

Microsoft Goes Open Source For The Next Generation of The Internet

Our data world is so 1980s! The Marriott hack shows us that we are often sloppy with our handling of citizen data, and things need to change. It’s difficult to know exactly what happened, but there are signs that much of the data was unencrypted, and that, for the data that was encrypted, that the encryption keys could be easily generated. That’s not data protection!

We have grown up in a world without any real encryption, and where we apply sticking plasters onto our data in order to secure it. We also have little in the way of embedded ownership or control on our data. This was the simple data world we created, but things have to change. With GDPR, we now have new rights to privacy, consent, and the right to be forgotten.

In our new world, things will become anonymised and data will be stored and transmitted in a way which it will be almost impossible to make any sense of it unless you have the rights to recreate the required encryption.

Our future world will be an entanglement of encryption keys, and where we properly applied strict policies on the usage of data. If I own some data, such as my shopping history, I should have rights to own the data, even though Amazon currently stores it. If I want to reveal some of this to other, for financial gain, it should be under my control. Our world will this merge encryption keys together, and where I can withdraw my key at any time, and where I revoke consent.

Day 0 of a new data world

We are currently at Day 0 in building this world, but build it we will. We see a data world full of fully anonymised transactions, and only if you have the right encryption keys will you be able to reveal the parts of this data trails that you are allowed access too.

Data thus needs to be protected at every stage of its journey — at rest, in transit and in process. These stages are often far from perfect, with the sticking plaster of TLS applied to protect the data on its journey across an untrusted network. So increasingly we encrypt the data at its source and then decrypt at its end destination. With TLS, we only protect the network tunnel, but not the application integration at either end. But what happens after that? Well, our data values become integers and strings again and reveal themselves in the memory of the running machine. So an intruder can reveal sensitive information by probing the memory of the running application.

And so we must now focus on the processing of data, and make sure that our data processors cannot leak sensitive information. For this we turn to homomorphic encryption, and which allows us to process encrypted values, and still make sense of them. It may have past you by, but Microsoft revealed something significant this week [Git hub]:

This library contains a whole range of homomorphic methods and where developers can use Microsoft’s open source libraries to build wonderful new applications, and where we can store, process and transmit data without ever revealing it. It would be a world where we didn’t need HTTPS any more, and the data would be encrypted at its source.

The world of Craig Gentry

Many methods for partial homomorphic encryption have been proposed. One of the most well-known ones is the Paillier method [here]. With this method we can add and multiply, and we cannot perform more complex logical operations.

Existing public key methods could also do partial homomorphic encryption, such as where we use the RSA method to multiply or divide two numbers:

  • RSA -partially homomorphic cryptosystem: Multiply. RSA. This outlines RSA as a partially homomorphic cryptosystem for multiplication.
  • RSA -partially homomorphic cryptosystem: Divide. RSA. This outlines RSA as a partially homomorphic cryptosystem for integer divide (and using the extended Euclidean method for the divide).

But it was Craig Gentry, in 2009, who first outlined a fully homomorphic encryption (FHE) scheme. With FHE we can operate on encrypted data and perform mathematical or logical calculations. In this world, a data processor would not need the encryption key to reveal the values, everything would be encrypted.

But other operations, such as add/subtract, and logical operations were out of reach for homomorphic. The genius of Craig is that he broke the data into bits, and then ciphered these. We could then apply a circuit of any logic function that we want, and then add the cipher bits to this, and receive a cipher output. The ciphered data could then be covered back into a result using a secret key.

With Gentry’s method, we get an odd number (p) and two random numbers (q and r), and encrypt a single bit (m) with [here]:

c=p×q+2×r+m

If 2r is smaller than p/2, we cipher with mod p we get:

d=(c mod p)(mod 2)

We have basically added noise to the value with the q and r values. The following shows some simple Python code to implement this:

import random
import sys


p=1001
m=0

if (m<>0) and (m<>1):
print 'M must be a 0 or a 1'

q=random.randint(3, 10)
r=random.randint(3, 10)

print 'P:\t\t',p
print 'q:\t\t',q
print 'r:\t\t',r

c = p*q + 2*r +m
print 'Cipher:\t\t',c
d = (c % p) %2

print 'Decipher:\t',d

Proving something with homomorphic encryption

With GDPR and the increasing rights of the citizen to privacy, consent and the right to be forgotten, we must move to a place where we do not store user passwords, either in a plain text form or in a hashed version. So, if we move to an anonymised world, how can we create a cipher puzzle where the user can scramble some bits and can prove their password (or identity)?

For this we can use Zero Knowledge Proof (ZPF) and implement homomorphic encryption. With this we can create a ciphered version of our password and which has noise added to it. The prover will then be able to check each version, even though different noise values have been added.

The following uses the method on homomorphic encryption from DGHV (Dijk, Gentry, Halevi and Vaikuntanathan). It converts the bits of a string into bits and then ciphers each bit. In this case, we have the same password (“A)”, and then strip-off the bits of the characters, and use the equation of:

c=p×q+2×r+m

where p is a secret value, q and r are random values, and m is the value of the bit. A sample run shows the cipher values:

Password A:  A Password B:  A
Cipher bits 1:
Bit Cipher q r
0 57928410850 5004182 9
1 61383036525 5302612 6
0 65284484234 5639641 9
0 65554355512 5662954 4
0 66653485136 5757903 4
0 59423798526 5133362 7
0 64855848106 5602613 9
1 61953432345 5351886 4
Cipher bits 2:
Bit Cipher q r
0 60735324596 5246659 6
1 69190724397 5977084 6
0 63084546462 5449598 7
0 69309100574 5987310 7
0 63980031092 5526955 6
0 68272689716 5897779 6
0 60974068028 5267283 10
1 62478322925 5397229 10
p value:	11576
Cipher result:
70061136992898186248234080225899277561295353982213174759347624292595011207692280636456205
Results
1
Passwords are the same

The result is deciphered with:

d=(c mod p)(mod 2)

If it is a ‘1’, the passwords match, else if it is a ‘0’ the passwords do not match.

Here is a simple calculator [here].

Conclusions

Our old data world is finished. We just can’t trust many companies to properly secure our data. So, here’s to the new one, and it’s one that respect everyone’s right to privacy, consent and the right to be forgotten.

We are actively working on new methods of citizen focused systems within our Blockpass ID Lab, so, if you want to build a better data world, come and collaborate with us.

Postscript

If you are interested, here are some other examples of homomorphic encryption:

  • Simple Homomorphic Cipher. Hom. This outlines a Simple Homomorphic cipher.
  • Simple Homomorphic Cipher (Python). Hom. This outlines a Simple Homomorphic cipher with Python.
  • Full Homomorphic Cipher for 2-bit Adder. Adder. This outlines a Simple Homomorphic cipher for a 2-bit adder with DGHV.
  • Full Homomorphic Cipher for Full Adder. Full Adder. This outlines a Simple Homomorphic cipher for a full adder with DGHV.
  • Full Homomorphic Cipher for 4-bit Adder. Adder. This outlines a Simple Homomorphic cipher for a 4-bit adder with DGHV.
  • Full Homomorphic Cipher for 4-bit Adder/Subtractor. Subtract. This outlines a Simple Homomorphic cipher for a 4-bit adder/subtractor with DGHV.
  • Full Homomorphic Cipher to determine if Bob is older. Older. This outlines a Simple Homomorphic cipher to determine if Bob is older than Alice.
  • Full Homomorphic Cipher to determine matching password. Password. This outlines a Simple Homomorphic cipher to determine if a password matches
  • Full Homomorphic Cipher to XOR two integers. X-OR. This outlines a Simple Homomorphic cipher to X-OR two integers
  • Full Homomorphic Cipher for Millionaire’s Problem. Millionaire. This outlines a Simple Homomorphic cipher for the Millionaire’s Problem
  • Full Homomorphic Cipher with a Public Key. Public key. This outlines a Simple Homomorphic cipher using a public key