mirror of https://github.com/beemdevelopment/Aegis
Use GCM instead of a hash to check master key integrity
This is the last database format change before the initial release, probablypull/120/head
parent
da37b5175e
commit
c3f94b37c8
@ -1,6 +1,36 @@
|
||||
package me.impy.aegis.crypto;
|
||||
|
||||
public class CryptParameters {
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import me.impy.aegis.encoding.Hex;
|
||||
import me.impy.aegis.encoding.HexException;
|
||||
|
||||
public class CryptParameters implements Serializable {
|
||||
public byte[] Nonce;
|
||||
public byte[] Tag;
|
||||
|
||||
public JSONObject toJson() {
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
try {
|
||||
obj.put("nonce", Hex.encode(Nonce));
|
||||
obj.put("tag", Hex.encode(Tag));
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static CryptParameters parseJson(JSONObject obj) throws JSONException, HexException {
|
||||
byte[] tag = Hex.decode(obj.getString("tag"));
|
||||
byte[] nonce = Hex.decode(obj.getString("nonce"));
|
||||
return new CryptParameters() {{
|
||||
Tag = tag;
|
||||
Nonce = nonce;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
package me.impy.aegis.db.slots;
|
||||
|
||||
public class SlotCollectionException extends Exception {
|
||||
public SlotCollectionException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public SlotCollectionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -1,5 +1,11 @@
|
||||
package me.impy.aegis.db.slots;
|
||||
|
||||
public class SlotIntegrityException extends Exception {
|
||||
public SlotIntegrityException() {
|
||||
|
||||
}
|
||||
|
||||
public SlotIntegrityException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package me.impy.aegis.db.slots;
|
||||
|
||||
public class SlotListException extends Exception {
|
||||
public SlotListException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public SlotListException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue