// Prepare output buffer
int outputLength = gcm.getOutputSize(cek.getEncoded().length);
byte[] output = new byte[outputLength];
// Produce cipher text
int outputOffset = gcm.processBytes(cek.getEncoded(), 0, cek.getEncoded().length, output, 0);
// Produce authentication tag
try {
outputOffset += gcm.doFinal(output, outputOffset);