Skip to content

Commit

Permalink
change name
Browse files Browse the repository at this point in the history
  • Loading branch information
mkleene committed Dec 3, 2024
1 parent 033be9f commit df2ea72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions sdk/src/main/java/io/opentdf/platform/sdk/Manifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ public class Manifest {
private static final Gson gson = new GsonBuilder()
.registerTypeAdapter(Manifest.class, new ManifestDeserializer())
.create();
String version;
String tdfVersion;

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Manifest manifest = (Manifest) o;
return Objects.equals(version, manifest.version) && Objects.equals(encryptionInformation, manifest.encryptionInformation) && Objects.equals(payload, manifest.payload) && Objects.equals(assertions, manifest.assertions);
return Objects.equals(tdfVersion, manifest.tdfVersion) && Objects.equals(encryptionInformation, manifest.encryptionInformation) && Objects.equals(payload, manifest.payload) && Objects.equals(assertions, manifest.assertions);
}

@Override
public int hashCode() {
return Objects.hash(version, encryptionInformation, payload, assertions);
return Objects.hash(tdfVersion, encryptionInformation, payload, assertions);
}

private static class PolicyBindingSerializer implements JsonDeserializer<Object>, JsonSerializer<Object> {
Expand Down
8 changes: 3 additions & 5 deletions sdk/src/main/java/io/opentdf/platform/sdk/TDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.channels.SeekableByteChannel;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -451,7 +449,7 @@ public TDFObject createTDF(InputStream payload,
byte[] readBuf = new byte[tdfConfig.defaultSegmentSize];

tdfObject.manifest.encryptionInformation.integrityInformation.segments = new ArrayList<>();
tdfObject.manifest.version = TDF_VERSION;
tdfObject.manifest.tdfVersion = TDF_VERSION;
long totalSize = 0;
boolean finished;
try (var payloadOutput = tdfWriter.payload()) {
Expand Down Expand Up @@ -684,7 +682,7 @@ public Reader loadTDF(SeekableByteChannel tdf, SDK.KAS kas,
}

var sig = calculateSignature(aggregateHash.toByteArray(), payloadKey, sigAlg);
if (manifest.version == null || manifest.version.isEmpty()) {
if (manifest.tdfVersion == null || manifest.tdfVersion.isEmpty()) {
sig = Hex.encodeHexString(sig).getBytes(StandardCharsets.UTF_8);
}
rootSigValue = Base64.getEncoder().encodeToString(sig);
Expand Down Expand Up @@ -725,7 +723,7 @@ public Reader loadTDF(SeekableByteChannel tdf, SDK.KAS kas,
var assertionAsJson = gson.toJson(assertion);
JsonCanonicalizer jc = new JsonCanonicalizer(assertionAsJson);
var hashOfAssertion = digest.digest(jc.getEncodedUTF8());
if (manifest.version == null || manifest.version.isEmpty()) {
if (manifest.tdfVersion == null || manifest.tdfVersion.isEmpty()) {
hashOfAssertion = Hex.encodeHexString(hashOfAssertion).getBytes(StandardCharsets.UTF_8);
}

Expand Down

0 comments on commit df2ea72

Please sign in to comment.