Skip to content

Commit

Permalink
Merge branch 'hotfix/2.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Aug 24, 2021
2 parents cad2d7d + 90bff24 commit dee93fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>cryptolib</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<name>Cryptomator Crypto Library</name>
<description>This library contains all cryptographic functions that are used by Cryptomator.</description>
<url>https://github.com/cryptomator/cryptolib</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public FileHeader decryptHeader(ByteBuffer ciphertextHeaderBuf) throws Authentic
buf.position(FileHeaderImpl.PAYLOAD_POS);
buf.get(ciphertextAndTag);

ByteBuffer payloadCleartextBuf = ByteBuffer.allocate(FileHeaderImpl.Payload.SIZE);
// FileHeaderImpl.Payload.SIZE + GCM_TAG_SIZE is required to fix a bug in Android API level pre 29, see https://issuetracker.google.com/issues/197534888
ByteBuffer payloadCleartextBuf = ByteBuffer.allocate(FileHeaderImpl.Payload.SIZE + GCM_TAG_SIZE);
try (DestroyableSecretKey ek = masterkey.getEncKey()) {
// decrypt payload:
Cipher cipher = CipherSupplier.AES_GCM.forDecryption(ek, new GCMParameterSpec(GCM_TAG_SIZE * Byte.SIZE, nonce));
assert cipher.getOutputSize(ciphertextAndTag.length) == payloadCleartextBuf.remaining();
int decrypted = cipher.doFinal(ByteBuffer.wrap(ciphertextAndTag), payloadCleartextBuf);
assert decrypted == FileHeaderImpl.Payload.SIZE;
payloadCleartextBuf.flip();
Expand Down

0 comments on commit dee93fd

Please sign in to comment.