Minor cleanup.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-06-15 12:26:29 -07:00
parent e16735bbbd
commit 485e8455bd

View File

@ -45,6 +45,8 @@ import android.util.Log;
public class DecryptingPartInputStream extends FileInputStream { public class DecryptingPartInputStream extends FileInputStream {
private static final String TAG = DecryptingPartInputStream.class.getSimpleName();
private static final int IV_LENGTH = 16; private static final int IV_LENGTH = 16;
private static final int MAC_LENGTH = 20; private static final int MAC_LENGTH = 20;
@ -68,16 +70,12 @@ public class DecryptingPartInputStream extends FileInputStream {
totalDataSize = file.length() - cipher.getBlockSize() - mac.getMacLength(); totalDataSize = file.length() - cipher.getBlockSize() - mac.getMacLength();
totalRead = 0; totalRead = 0;
} catch (InvalidKeyException ike) { } catch (InvalidKeyException ike) {
Log.w("EncryptingPartInputStream", ike); Log.w(TAG, ike);
throw new FileNotFoundException("Invalid key!"); throw new FileNotFoundException("Invalid key!");
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | NoSuchPaddingException e) {
throw new AssertionError(e);
} catch (InvalidAlgorithmParameterException e) {
throw new AssertionError(e);
} catch (NoSuchPaddingException e) {
throw new AssertionError(e); throw new AssertionError(e);
} catch (IOException e) { } catch (IOException e) {
Log.w("EncryptingPartInputStream", e); Log.w(TAG, e);
throw new FileNotFoundException("IOException while reading IV!"); throw new FileNotFoundException("IOException while reading IV!");
} }
} }
@ -130,13 +128,13 @@ public class DecryptingPartInputStream extends FileInputStream {
done = true; done = true;
return flourish; return flourish;
} catch (IllegalBlockSizeException e) { } catch (IllegalBlockSizeException e) {
Log.w("EncryptingPartInputStream", e); Log.w(TAG, e);
throw new IOException("Illegal block size exception!"); throw new IOException("Illegal block size exception!");
} catch (ShortBufferException e) { } catch (ShortBufferException e) {
Log.w("EncryptingPartInputStream", e); Log.w(TAG, e);
throw new IOException("Short buffer exception!"); throw new IOException("Short buffer exception!");
} catch (BadPaddingException e) { } catch (BadPaddingException e) {
Log.w("EncryptingPartInputStream", e); Log.w(TAG, e);
throw new IOException("Bad padding exception!"); throw new IOException("Bad padding exception!");
} }
} }