awslabs / homomorphic-implementors-toolkit

Apache License 2.0
64 stars 8 forks source link

Parameterize ciphertexts with an evaluator #45

Open crockeea opened 4 years ago

crockeea commented 4 years ago

Ciphertexts are designed to be used with a single evaluator: they are encrypted via an evaluator, which packs the right information into the CKKSCiphertext object (either a plaintxt, a ciphertext, both, or neither).

This was brought up in a security review (how can we prevent accidentally sending a plaintext to an untrusted party), and it's also a problem in ciphertext deserialization: we don't know when to expect a raw_pt or seal_ct in a serialized object. For example, if we are trying to load a ciphertext for use with the Homomorphic evaluator, but the serialized object doesn't contain a SEAL ciphertext, then that should be an error. Currently, we happily load that ciphertext, and it will result in something horrible at runtime (most likely a SEAL error).

crockeea commented 4 years ago

My proposed solution is to tag encrypted objects (Ciphertexts, Matrices, and Row/ColVectors) by an evaluator type. This prevents mixing ciphertexts with an evaluator for which they are not intended.

crockeea commented 4 years ago

In addition to providing safer serialization, this could prevent users from, e.g., requestion a plaintext that doesn't exist.