edits
authorbdemsky <bdemsky@uci.edu>
Sun, 24 Jul 2016 07:44:49 +0000 (00:44 -0700)
committerbdemsky <bdemsky@uci.edu>
Sun, 24 Jul 2016 07:44:49 +0000 (00:44 -0700)
src/java/iotcloud/CloudComm.java

index 85f6b08..85c95bb 100644 (file)
@@ -30,8 +30,8 @@ class CloudComm {
                        SecureRandom random = new SecureRandom();
                        random.nextBytes(salt);
                        PBEKeySpec keyspec = new PBEKeySpec(password.toCharArray(), salt, 65536, 128);
-                       SecretKey key = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(keyspec);
-                       key = new SecretKeySpec(key.getEncoded(), "AES");
+                       SecretKey tmpkey = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(keyspec);
+                       this.key = new SecretKeySpec(tmpkey.getEncoded(), "AES");
                } catch (Exception e) {
                        e.printStackTrace();
                        throw new Error("Failed generating key.");