From 01e032f9a2dac59a12a911622e736fd6b8a1b32a Mon Sep 17 00:00:00 2001 From: Paul Flynn Date: Thu, 31 Oct 2024 09:55:54 -0400 Subject: [PATCH 1/2] Update SDK dependency version to 0.7.5 Upgraded the SDK version from 0.7.3 to 0.7.5 in the `pom.xml` file. This update is necessary for compatibility with new features and bug fixes provided in the latest SDK release. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index db5e9ec..964bc98 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ io.opentdf.platform sdk - 0.7.3 + 0.7.5 org.apache.commons From 2bbacadf8692e67d4076c8205d24655039914075 Mon Sep 17 00:00:00 2001 From: Paul Flynn Date: Fri, 1 Nov 2024 13:08:16 -0400 Subject: [PATCH 2/2] Remove unused imports and simplify TDF reading logic Unused imports were removed to clean up the code. Additionally, the assertion verification keys list population and usage were eliminated to simplify the TDF reading logic in the processFlowFiles method. --- .../java/io/opentdf/nifi/ConvertFromZTDF.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/nifi-tdf-processors/src/main/java/io/opentdf/nifi/ConvertFromZTDF.java b/nifi-tdf-processors/src/main/java/io/opentdf/nifi/ConvertFromZTDF.java index a53bb20..2b6cbd0 100644 --- a/nifi-tdf-processors/src/main/java/io/opentdf/nifi/ConvertFromZTDF.java +++ b/nifi-tdf-processors/src/main/java/io/opentdf/nifi/ConvertFromZTDF.java @@ -1,8 +1,10 @@ package io.opentdf.nifi; -import io.opentdf.platform.sdk.Config; import io.opentdf.platform.sdk.SDK; import io.opentdf.platform.sdk.TDF; +import java.io.IOException; +import java.nio.channels.SeekableByteChannel; +import java.util.List; import org.apache.commons.compress.utils.SeekableInMemoryByteChannel; import org.apache.nifi.annotation.documentation.CapabilityDescription; import org.apache.nifi.annotation.documentation.Tags; @@ -11,11 +13,6 @@ import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.exception.ProcessException; -import java.io.IOException; -import java.nio.channels.SeekableByteChannel; -import java.util.ArrayList; -import java.util.List; - /** * Converts and decrypts ZTDF (Zero Trust Data Format) flow file content. * This class takes encrypted ZTDF content and decrypts it, @@ -65,14 +62,15 @@ public ConvertFromZTDF() { @Override void processFlowFiles(ProcessContext processContext, ProcessSession processSession, List flowFiles) throws ProcessException { SDK sdk = getTDFSDK(processContext); - //TODO add assertion verification key list population - List assertionVerificationKeysList = new ArrayList<>(); for (FlowFile flowFile : flowFiles) { try { try (SeekableByteChannel seekableByteChannel = new SeekableInMemoryByteChannel(readEntireFlowFile(flowFile, processSession))) { FlowFile updatedFlowFile = processSession.write(flowFile, outputStream -> { try { - TDF.Reader reader = getTDF().loadTDF(seekableByteChannel, sdk.getServices().kas(), assertionVerificationKeysList.toArray(new Config.AssertionVerificationKeys[0])); + TDF.Reader reader = getTDF().loadTDF( + seekableByteChannel, + sdk.getServices().kas() + ); reader.readPayload(outputStream); } catch (Exception e) { getLogger().error("error decrypting ZTDF", e);