Replace implementations of Base16, Base32 and Base64 with Guava

I kept the classes in the encoding package and turned them into wrappers for
Guava. I also changed the functions in the Base32 class to take and return
strings insteads if character arrays.
This commit is contained in:
Alexander Bakker 2019-12-26 20:47:28 +01:00
parent 833e75ade1
commit 10ac1af6b0
23 changed files with 88 additions and 254 deletions

View file

@ -1,7 +1,7 @@
package com.beemdevelopment.aegis.otp;
import com.beemdevelopment.aegis.encoding.Base32;
import com.beemdevelopment.aegis.encoding.Base32Exception;
import com.beemdevelopment.aegis.encoding.EncodingException;
import org.json.JSONException;
import org.json.JSONObject;
@ -93,7 +93,7 @@ public abstract class OtpInfo implements Serializable {
OtpInfo info;
try {
byte[] secret = Base32.decode(obj.getString("secret").toCharArray());
byte[] secret = Base32.decode(obj.getString("secret"));
String algo = obj.getString("algo");
int digits = obj.getInt("digits");
@ -110,7 +110,7 @@ public abstract class OtpInfo implements Serializable {
default:
throw new OtpInfoException("unsupported otp type: " + type);
}
} catch (Base32Exception | JSONException e) {
} catch (EncodingException | JSONException e) {
throw new OtpInfoException(e);
}