You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nlu90 (via GitHub)" <gi...@apache.org> on 2023/02/06 21:49:28 UTC

[GitHub] [pulsar] nlu90 commented on a diff in pull request #18738: [improve][fn] Support e2e cryption in python instance

nlu90 commented on code in PR #18738:
URL: https://github.com/apache/pulsar/pull/18738#discussion_r1097956509


##########
pulsar-functions/instance/src/main/python/python_instance.py:
##########
@@ -460,3 +472,16 @@ def close(self):
 
     if self.pulsar_client:
       self.pulsar_client.close()
+
+  def get_crypto_reader(self, crypto_spec):
+    crypto_key_reader = None
+    if crypto_spec is not None:
+      try:
+        crypto_config = json.loads(crypto_spec.cryptoKeyReaderConfig)
+        if crypto_spec.cryptoKeyReaderClassName == "" or crypto_spec.cryptoKeyReaderClassName is None:
+          crypto_key_reader = pulsar.CryptoKeyReader(**crypto_config)
+        else:
+          crypto_key_reader = util.import_class(os.path.dirname(self.user_code), crypto_spec.cryptoKeyReaderClassName)(**crypto_config)
+      except:
+        pass

Review Comment:
   +1 for a clear error message



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org