Using the AES implementation in HElib; AddCtxt function error

I am currently playing around with the HElib homomorphic library and I have a problem with the AES implementation.

In one hand, I manage to do a simple HE encryption on plaintext and do some operation on the ciphertext. It works well. On the other hand, I used the AES implementation over HElib to encrypt and decrypt data and that works well too.

Now I want to use the full power of this implementation: perform some HE operation on data encrypted with this AES.

With simple HE encryption, operations are done on the Ctxt object, but when we use the AES implementation, the whole encryption text is a Ctxt vector, and I can't figure out how I can complete this vector.

I took the Test_AES.cpp file as an example and I use the same parameters to create the context and generate the key. (I'll only put the parts here that I believe are important and let's assume you know a little about this library, but if you want all the code, I can write it)

So first I encrypt a simple vector of 1.

Vec<uint8_t> ptxt(INIT_SIZE,nBlocks*16); //Vector of 1
vector<Ctxt> doublyEncrypted;
hAES.homAESenc(doublyEncrypted,encryptedAESkey,ptxt); // Encryption of the vector store
                                                      //in doublyEncrypted

      

Since the library says normaly, we have doubleEncrypted = Enc_HE (Enc_AES (myvector)).

Now decryption

hAES.homeAESdec(doublyEncrypted,encryptedAESkey);

      

Now our doubleEncrypted is Enc_HE (myvector). At this point, I have to perform some operation on my encrypted vector. Since doubleEncrypted is a Ctxt vector, I tried something like:

for(long i=0;i<(long)doublyEncrypted.size();i++){
    doublyEncrypted[i].addCtxt(doublyEncrypted[i]);
}

      

But when I decrypt it with the secret key and decrypt it, all I got is vector 0 (I have to get a vector of 2). I also tried adding another encrypted vector, but there I got a vector of some random hex value.

So my question is, is it possible with this AES implementation on HElib to perform some operation on the encryption text, and does anyone use this library enough to do it.

Thanks in advance!

+3


source to share


1 answer


If anyone ever comes across this:



The poster clearly seems to have misunderstood how homomorphic encryption works. In the example code, they first encrypt the plaintext homomorphically using HElib. This ciphertext is then manipulated using homomorphic properties into ciphertext, which is AES plaintext encryption. Adding something to this AES encryption will obviously give a pointless result. HElib does not magically transform AES into a homomorphic cryptosystem.

+1


source







All Articles