Skip to content

Commit

Permalink
UVF: use 64 bit keys for HMAC-SHA256
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Mar 6, 2025
1 parent 361b3b0 commit 1e9bd32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FileNameCryptorImpl implements FileNameCryptor {
*/
FileNameCryptorImpl(RevolvingMasterkey masterkey, int revision) throws IllegalArgumentException {
this.sivKey = masterkey.subKey(revision, 64, "siv".getBytes(StandardCharsets.US_ASCII), "AES");
this.hmacKey = masterkey.subKey(revision, 32, "hmac".getBytes(StandardCharsets.US_ASCII), "HMAC");
this.hmacKey = masterkey.subKey(revision, 64, "hmac".getBytes(StandardCharsets.US_ASCII), "HMAC");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testDeterministicEncryptionOf128bitFilename() throws AuthenticationF
public void testHashRootDirId() {
final byte[] rootDirId = Base64.getDecoder().decode("24UBEDeGu5taq7U4GqyA0MXUXb9HTYS6p3t9vvHGJAc=");
final String hashedRootDirId = filenameCryptor.hashDirectoryId(rootDirId);
Assertions.assertEquals("CRAX3I7DP4HQHA6TDQDMJQUTDKDJ7QG5", hashedRootDirId);
Assertions.assertEquals("6DYU3E5BTPAZ4DWEQPQK3AIHX2DXSPHG", hashedRootDirId);
}

@DisplayName("hash directory id for random directory ids")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testRootDirId() {
public void testRootDirHash() {
byte[] rootDirId = Base64.getDecoder().decode("5WEGzwKkAHPwVSjT2Brr3P3zLz7oMiNpMn/qBvht7eM=");
String dirHash = cryptor.fileNameCryptor(masterkey.firstRevision()).hashDirectoryId(rootDirId);
Assertions.assertEquals("RKHZLENL3PQIW6GZHE3KRRRGLFBHWHRU", dirHash);
Assertions.assertEquals("RZK7ZH7KBXULNEKBMGX3CU42PGUIAIX4", dirHash);
}

@Test
Expand Down

0 comments on commit 1e9bd32

Please sign in to comment.