natural commented on a change in pull request #4077: NIFI-5346 Introduces new 
PGP controller service and PGP processors.
URL: https://github.com/apache/nifi/pull/4077#discussion_r403226394
 
 

 ##########
 File path: 
nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/pgp/PGPOperator.java
 ##########
 @@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.security.pgp;
+
+import org.apache.nifi.context.PropertyContext;
+import org.apache.nifi.flowfile.FlowFile;
+import org.bouncycastle.bcpg.HashAlgorithmTags;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPPrivateKey;
+import org.bouncycastle.openpgp.PGPPublicKey;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * The PGPOperator is responsible for defining and providing high-level PGP 
cryptographic operations.
+ *
+ */
+public interface PGPOperator {
+    /**
+     * Read from an {@link InputStream} and write an encrypted representation 
to an {@link OutputStream}.
+     *
+     * @param input plain data
+     * @param output receives encrypted data
+     * @param options used to configure encryption operation
+     */
+    void encrypt(InputStream input, OutputStream output, EncryptOptions 
options) throws IOException, PGPException;
+
+    /**
+     * Read from an encrypted {@link InputStream} and write a decrypted 
representation to an {@link OutputStream}.
+     *
+     * @param input encrypted data
+     * @param output receives decrypted data
+     * @param options used to configure decryption operation
+     */
+    void decrypt(InputStream input, OutputStream output, DecryptOptions 
options) throws IOException;
+
+    /**
+     * Read from an {@link InputStream} to generate a signature written to an 
{@link OutputStream}.
+     *
+     * @param input clear or cipher data
+     * @param signature receives signature
+     * @param options used to configure sign operation
+     */
+    void sign(InputStream input, OutputStream signature, SignOptions options) 
throws IOException, PGPException;
 
 Review comment:
   There are no plans for a `SignContentPGPProcessor` of which I'm aware, but 
it sounds like a good addition; could you open a jira ticket for the feature 
if/when this PR is merged?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to