throw new ObjectClosedException();
if (f == null)
throw new NoPrivateKeyException();
int expectedCTLength = BitPack.pack(keyParams.N, keyParams.q);
if (ciphertext.length != expectedCTLength)
throw new CiphertextBadLengthException(
ciphertext.length, expectedCTLength);
boolean fail = false;
// Unpack ciphertext into the polynomial e.
FullPolynomial e = new FullPolynomial(keyParams.N);
int numUnpacked = BitPack.unpack(
keyParams.N, keyParams.q, ciphertext, 0, e.p, 0);
if (numUnpacked != ciphertext.length)
throw new CiphertextBadLengthException(
ciphertext.length, BitPack.pack(keyParams.N, keyParams.q));
// a = f*e with coefficients reduced to range [A..A+q-1], where
// A = lower bound decryption coefficient (-q/2 in all param sets)
FullPolynomial ci = FullPolynomial.convolution(f, e, keyParams.q);