mirror of
https://github.com/etesync/android
synced 2025-01-11 00:01:12 +00:00
CryptoManager: add an HMAC_SIZE (in bytes) constant.
This commit is contained in:
parent
56996b98c4
commit
d80cce9aad
@ -35,6 +35,8 @@ public class Crypto {
|
||||
}
|
||||
|
||||
public static class CryptoManager {
|
||||
final static int HMAC_SIZE = 256 / 8; // hmac256 in bytes
|
||||
|
||||
private SecureRandom _random = null;
|
||||
@Getter
|
||||
private final byte version;
|
||||
|
@ -19,6 +19,7 @@ import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static com.etesync.syncadapter.journalmanager.Crypto.CryptoManager.HMAC_SIZE;
|
||||
import static com.etesync.syncadapter.journalmanager.Crypto.sha256;
|
||||
import static com.etesync.syncadapter.journalmanager.Crypto.toHex;
|
||||
|
||||
@ -93,7 +94,6 @@ public class JournalManager extends BaseManager {
|
||||
@Getter
|
||||
private int version = -1;
|
||||
|
||||
final private transient int hmacSize = 256 / 8; // hmac256 in bytes
|
||||
private transient byte[] hmac = null;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ -108,8 +108,8 @@ public class JournalManager extends BaseManager {
|
||||
}
|
||||
|
||||
private void processFromJson() {
|
||||
hmac = Arrays.copyOfRange(getContent(), 0, hmacSize);
|
||||
setContent(Arrays.copyOfRange(getContent(), hmacSize, getContent().length));
|
||||
hmac = Arrays.copyOfRange(getContent(), 0, HMAC_SIZE);
|
||||
setContent(Arrays.copyOfRange(getContent(), HMAC_SIZE, getContent().length));
|
||||
}
|
||||
|
||||
void verify(Crypto.CryptoManager crypto) throws Exceptions.IntegrityException {
|
||||
|
Loading…
Reference in New Issue
Block a user