First cut - v0.1.1
WARNING
First very rough release - Don't use for anything serious yet! Not reviewed by a cryptographer.
In particular note that I don't obfuscate the results of encrypted math operations by default. This is an
optimization copied from python-paillier, however after any homomorphic operation - before sharing an EncryptedNumber
or EncryptedArray
you must call obfuscate()
to secure the ciphertext.
Ideally this will occur behind the scenes at serialization time.
Quick Example
julia> using Paillier
julia> pub, priv = generate_paillier_keypair(1024)
julia> a = encrypt(pub, 10)
julia> b = encrypt(pub, 50)
julia> decrypt(priv, a)
10
julia> decrypt(priv, a + 5)
15
julia> # obfuscate before sharing an encrypted number:
julia> c = obfuscate(2a + b);
julia> typeof(c)
EncryptedNumber
julia> decrypt(priv, c)
70
Array Support
To avoid wasting space having multiple copies of the same PublicKey
I've added an
EncryptedArray
type that shares one public key for an array of ciphertexts.
julia> a = [0,1,2,3,4,5]
julia> enca = encrypt(publickey, a)
julia> encb = 2 * enca
julia> decrypt(privatekey, reduce(+, encb))
30