¿Cómo hacer el cifrado y descifrado de un archivo?

yo sueloCipherOutputStream para cifrar y descifrar archivos en java, pero el archivo de entrada> 117 bytes no puede cifrarse. Yo uso el algoritmo RSA de longitud de clave pública 1024 bytes.

cipher.init(Cipher.ENCRYPT_MODE, secKey);

String cleartextFile = "cleartext.txt";
String ciphertextFile = "ciphertextSymm.txt";

FileInputStream fis = new FileInputStream(cleartextFile);
FileOutputStream fos = new FileOutputStream(ciphertextFile);
CipherOutputStream cos = new CipherOutputStream(fos, cipher);

byte[] block = new byte[8];
int i;
while ((i = fis.read(block)) != -1) {
      cos.write(block, 0, i);
}
cos.close();

Como encripcioninput longitud del archivo> 117 bytes?

Respuestas a la pregunta(1)

Su respuesta a la pregunta