@@ -111,7 +111,7 @@ public static void encrypt(byte[] key, String inputPath, String outputPath) thro
111111 NoSuchPaddingException , InvalidKeyException , InvalidAlgorithmParameterException , IOException {
112112 //Generate Initilisation Vector
113113 SecureRandom sr = new SecureRandom ();
114- byte [] initVector = new byte [16 ];
114+ final byte [] initVector = new byte [16 ];
115115 sr .nextBytes (initVector ); // 16 bytes IV
116116
117117 // Initialize Vector and Keys
@@ -134,7 +134,7 @@ public static void encrypt(byte[] key, String inputPath, String outputPath) thro
134134
135135 // Compute Mac for authentication
136136 hmac .update (initVector );
137- byte [] mac = computeMac (hmac , plaintextFile );
137+ final byte [] mac = computeMac (hmac , plaintextFile );
138138
139139 // Display the Base64 encoded versions of Vector and computed mac
140140 System .out .print ("\n <---------------------------------------->\n " );
@@ -279,8 +279,8 @@ private static boolean writeDecryptedFile(Path inputPath, Path outputPath, byte[
279279 try (InputStream encryptedData = Files .newInputStream (inputPath );){
280280
281281 // Read metadata from the input file
282- byte [] initVector = new byte [16 ];
283- byte [] givenMac = new byte [32 ];
282+ final byte [] initVector = new byte [16 ];
283+ final byte [] givenMac = new byte [32 ];
284284
285285 encryptedData .read (initVector );
286286 encryptedData .read (givenMac );
0 commit comments