collection of fixes based on comments/small aesthetic stuff // FREEBIE

This commit is contained in:
Jake McGinty
2014-02-18 16:28:54 -08:00
parent d19ab04bdd
commit 9d9a0ec218
8 changed files with 14 additions and 14 deletions

View File

@@ -103,11 +103,11 @@ public class DecryptingPartInputStream extends FileInputStream {
try {
int flourish = cipher.doFinal(buffer, offset);
// mac.update(buffer, offset, flourish);
byte[] ourMac = mac.doFinal();
byte[] theirMac = new byte[mac.getMacLength()];
readFully(theirMac);
if (!Arrays.equals(ourMac, theirMac))
throw new IOException("MAC doesn't match! Potential tampering?");
@@ -175,7 +175,7 @@ public class DecryptingPartInputStream extends FileInputStream {
return readLength;
} catch (ShortBufferException e) {
throw new AssertionError(e);
}
}
}
private Mac initializeMac(SecretKeySpec key) throws NoSuchAlgorithmException, InvalidKeyException {
@@ -214,6 +214,4 @@ public class DecryptingPartInputStream extends FileInputStream {
else return;
}
}
}