Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update OpenTDF SDK dependency version to 0.7.5 #43

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -65,14 +62,15 @@ public ConvertFromZTDF() {
@Override
void processFlowFiles(ProcessContext processContext, ProcessSession processSession, List<FlowFile> flowFiles) throws ProcessException {
SDK sdk = getTDFSDK(processContext);
//TODO add assertion verification key list population
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttschampel should we Config.withDisableAssertionVerification(true) ?

List<Config.AssertionVerificationKeys> 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);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<dependency>
<groupId>io.opentdf.platform</groupId>
<artifactId>sdk</artifactId>
<version>0.7.3</version>
<version>0.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down