Skip to content

Commit

Permalink
Fix the issues bug - can't decrypt tdfs with assertion created with o…
Browse files Browse the repository at this point in the history
…lder version of sdks
  • Loading branch information
sujankota committed Jan 2, 2025
1 parent a4212bd commit f1cce4f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sdk/src/main/java/io/opentdf/platform/sdk/TDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public class TDF {

private static final String TDF_VERSION = "1.0.0";
private static final String TDF_VERSION = "4.3.0";
private final long maximumSize;

/**
Expand Down Expand Up @@ -733,8 +733,7 @@ public Reader loadTDF(SeekableByteChannel tdf, SDK.KAS kas,
throw new AssertionException("assertion hash mismatch", assertion.id);
}

var hashOfAssertion = Hex.decodeHex(hashOfAssertionAsHex);

byte[] hashOfAssertion = isLegacyTdf ? hashOfAssertionAsHex.getBytes(StandardCharsets.UTF_8) : Hex.decodeHex(hashOfAssertionAsHex);
var signature = new byte[aggregateHashByteArrayBytes.length + hashOfAssertion.length];
System.arraycopy(aggregateHashByteArrayBytes, 0, signature, 0, aggregateHashByteArrayBytes.length);
System.arraycopy(hashOfAssertion, 0, signature, aggregateHashByteArrayBytes.length, hashOfAssertion.length);
Expand Down

0 comments on commit f1cce4f

Please sign in to comment.