From 7e2c130561234df38a42f5a92ebf4ad95429c0b6 Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 26 Dec 2014 17:37:40 +0200 Subject: [PATCH] renamed encrypt/decryptByteStream to just enc/dec (overload consistency) --- src/nodash/core/NoUtil.java | 6 +++--- src/nodash/models/NoUser.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nodash/core/NoUtil.java b/src/nodash/core/NoUtil.java index 231a915..2b8e65a 100644 --- a/src/nodash/core/NoUtil.java +++ b/src/nodash/core/NoUtil.java @@ -79,7 +79,7 @@ public final class NoUtil { } } - public static byte[] getPBEKeyFromPassword(char[] password) { + private static byte[] getPBEKeyFromPassword(char[] password) { SecretKeyFactory skf; try { skf = SecretKeyFactory.getInstance(NoUtil.PBE_TYPE); @@ -106,14 +106,14 @@ public final class NoUtil { } } - public static byte[] decryptByteArray(byte[] data, char[] password) throws IllegalBlockSizeException, BadPaddingException { + public static byte[] decrypt(byte[] data, char[] password) throws IllegalBlockSizeException, BadPaddingException { byte[] passwordByte = NoUtil.getPBEKeyFromPassword(password); byte[] response = NoUtil.decrypt(NoUtil.decrypt(data), passwordByte); NoUtil.wipeBytes(passwordByte); return response; } - public static byte[] encryptByteArray(byte[] data, char[] password) { + public static byte[] encrypt(byte[] data, char[] password) { byte[] passwordByte = NoUtil.getPBEKeyFromPassword(password); byte[] response = NoUtil.encrypt(NoUtil.encrypt(data, passwordByte)); NoUtil.wipeBytes(passwordByte); diff --git a/src/nodash/models/NoUser.java b/src/nodash/models/NoUser.java index 4477fcf..9548049 100644 --- a/src/nodash/models/NoUser.java +++ b/src/nodash/models/NoUser.java @@ -87,7 +87,7 @@ public class NoUser implements Serializable { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); - byte[] encrypted = NoUtil.encryptByteArray(baos.toByteArray(), password); + byte[] encrypted = NoUtil.encrypt(baos.toByteArray(), password); oos.close(); baos.close(); return encrypted; @@ -165,7 +165,7 @@ public class NoUser implements Serializable { } public static NoUser createUserFromFile(byte[] data, char[] password) throws IllegalBlockSizeException, BadPaddingException, IOException, ClassNotFoundException { - byte[] decrypted = NoUtil.decryptByteArray(data, password); + byte[] decrypted = NoUtil.decrypt(data, password); ByteArrayInputStream bais = new ByteArrayInputStream(decrypted); ObjectInputStream ois = new ObjectInputStream(bais); NoUser noUser = (NoUser) ois.readObject();