파일을 암호화하는이 기능이 있는데 암호화 비트가 작동하는 것 같지만 현재 파일을 덮어 쓸 수 없습니다. 이것은 잘 작동암호문으로 일반 텍스트 파일 덮어 쓰기
는FileInputStream inputStream = new FileInputStream(input); // Selects file to encrypt
cipher.init(Cipher.ENCRYPT_MODE, secret, ivSpec); // Sets up the encryption
// Creates an the output stream, the encryption is performed here
CipherOutputStream cos = new CipherOutputStream(new FileOutputStream(input + ".secure"), cipher);
byte[] block = new byte[8];
int i;
while ((i = inputStream.read(block)) != -1) // Reads the file
{
cos.write(block, 0, i); // Writes the new file
}
cos.close();
, 내가 original_file_name.txt.secure
에 암호화 된 파일로 끝날,하지만 난 원래 파일을 덮어 쓸 것인지. .secure
비트를 제거하면 제대로 파일을 쓰지 않습니다.
파일 원본 파일을 암호화 된 텍스트로 어떻게 덮어 쓸 수 있습니까?