Skip to content

Commit 8528f7f

Browse files
overheadhunterchenkins
authored andcommitted
UVF: use 64 bit keys for HMAC-SHA256
see encryption-alliance/unified-vault-format#31
1 parent 51caf09 commit 8528f7f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/main/java/org/cryptomator/cryptolib/v3/FileNameCryptorImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FileNameCryptorImpl implements FileNameCryptor {
3636
*/
3737
FileNameCryptorImpl(RevolvingMasterkey masterkey, int revision) throws IllegalArgumentException {
3838
this.sivKey = masterkey.subKey(revision, 64, "siv".getBytes(StandardCharsets.US_ASCII), "AES");
39-
this.hmacKey = masterkey.subKey(revision, 32, "hmac".getBytes(StandardCharsets.US_ASCII), "HMAC");
39+
this.hmacKey = masterkey.subKey(revision, 64, "hmac".getBytes(StandardCharsets.US_ASCII), "HMAC");
4040
}
4141

4242
@Override

src/test/java/org/cryptomator/cryptolib/v3/FileNameCryptorImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void testDeterministicEncryptionOf128bitFilename() throws AuthenticationF
7979
public void testHashRootDirId() {
8080
final byte[] rootDirId = Base64.getDecoder().decode("24UBEDeGu5taq7U4GqyA0MXUXb9HTYS6p3t9vvHGJAc=");
8181
final String hashedRootDirId = filenameCryptor.hashDirectoryId(rootDirId);
82-
Assertions.assertEquals("CRAX3I7DP4HQHA6TDQDMJQUTDKDJ7QG5", hashedRootDirId);
82+
Assertions.assertEquals("6DYU3E5BTPAZ4DWEQPQK3AIHX2DXSPHG", hashedRootDirId);
8383
}
8484

8585
@DisplayName("hash directory id for random directory ids")

src/test/java/org/cryptomator/cryptolib/v3/UVFIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void testRootDirId() {
5656
public void testRootDirHash() {
5757
byte[] rootDirId = Base64.getDecoder().decode("5WEGzwKkAHPwVSjT2Brr3P3zLz7oMiNpMn/qBvht7eM=");
5858
String dirHash = cryptor.fileNameCryptor(masterkey.firstRevision()).hashDirectoryId(rootDirId);
59-
Assertions.assertEquals("RKHZLENL3PQIW6GZHE3KRRRGLFBHWHRU", dirHash);
59+
Assertions.assertEquals("RZK7ZH7KBXULNEKBMGX3CU42PGUIAIX4", dirHash);
6060
}
6161

6262
@Test

0 commit comments

Comments
 (0)