mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-14 13:03:13 +02:00
Ensure cloud sync IV is 12 bytes
This commit is contained in:
@@ -777,7 +777,8 @@ public class CloudSync {
|
||||
|
||||
private static byte[] getIv(long revision) {
|
||||
byte[] iv = ByteBuffer.allocate(12)
|
||||
.putLong(revision)
|
||||
.putLong(revision) // 8 bytes
|
||||
.putInt(0) // 4 bytes
|
||||
.array();
|
||||
return iv;
|
||||
}
|
||||
@@ -785,7 +786,7 @@ public class CloudSync {
|
||||
private static byte[] getAd(String key, long revision) throws NoSuchAlgorithmException {
|
||||
byte[] k = MessageDigest.getInstance("SHA256").digest(key.getBytes());
|
||||
byte[] ad = ByteBuffer.allocate(8 + 8)
|
||||
.putLong(revision)
|
||||
.putLong(revision) // 8 bytes
|
||||
.put(Arrays.copyOfRange(k, 0, 8))
|
||||
.array();
|
||||
return ad;
|
||||
|
||||
Reference in New Issue
Block a user