This is the description of GaloisKey in seal / keygenerator.h from the Microsoft SEAL-3.4 library :
/**
Generates and returns Galois keys. This function creates specific Galois
keys that can be used to apply specific Galois automorphisms on encrypted
data. The user needs to give as input a vector of Galois elements
corresponding to the keys that are to be created.
The Galois elements are odd integers in the interval [1, M-1], where
M = 2*N, and N = poly_modulus_degree. Used with batching, a Galois element
3^i % M corresponds to a cyclic row rotation i steps to the left, and
a Galois element 3^(N/2-i) % M corresponds to a cyclic row rotation i
steps to the right. The Galois element M-1 corresponds to a column rotation
(row swap) in BFV, and complex conjugation in CKKS. In the polynomial view
(not batching), a Galois automorphism by a Galois element p changes
Enc(plain(x)) to Enc(plain(x^p)).
@param[in] galois_elts The Galois elements for which to generate keys
@throws std::logic_error if the encryption parameters do not support
batching and scheme is scheme_type::BFV
@throws std::logic_error if the encryption parameters do not support
keyswitching
@throws std::invalid_argument if the Galois elements are not valid
*/
SEAL_NODISCARD inline GaloisKeys galois_keys(
const std::vector<std::uint64_t> &galois_elts)
{
return galois_keys(galois_elts, false);
}
How can I create a better Galois elements for the GaloisKey.
In a general way:
GaloisKey gal_keys = keygen.galois_keys();
But Ciphertext first rotation is right,second rotation is wrong.
The specific error is, for example, one of my ciphertexts is [0.0001,0.0001, ... 0.0001], after rotation, the decryption is [1.0000,1.2000,1.7000 ...]