fixed change pw function leaving invalid JSON file if length gets shorter due to different encoding or pretty printing etc

This commit is contained in:
Sebastian Stenzel
2016-09-14 17:22:26 +02:00
parent 09ba4f5129
commit 47133c6f31

View File

@@ -103,6 +103,7 @@ class Masterkeys {
private static void writeMasterKey(File file, Cryptor cryptor, CharSequence passphrase) throws UncheckedIOException {
try (WritableFile writable = file.openWritable()) {
writable.truncate();
final byte[] fileContents = cryptor.writeKeysToMasterkeyFile(passphrase);
writable.write(ByteBuffer.wrap(fileContents));
}