You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/25 03:31:53 UTC

[GitHub] [pulsar] Anonymitaet opened a new pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Anonymitaet opened a new pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707


   Add docs for https://github.com/apache/pulsar/pull/9588 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Huanli-Meng commented on a change in pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Posted by GitBox <gi...@apache.org>.
Huanli-Meng commented on a change in pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707#discussion_r583302225



##########
File path: site2/docs/client-libraries-python.md
##########
@@ -288,3 +288,103 @@ class Example(Record):
     a = String()
     sub = MySubRecord()
 ```
+
+## End-to-end encryption
+
+[End-to-end encryption](https://pulsar.apache.org/docs/en/next/cookbooks-encryption/#docsNav) allows applications to encrypt messages at producers and decrypt at consumers.

Review comment:
       ```suggestion
   [End-to-end encryption](https://pulsar.apache.org/docs/en/next/cookbooks-encryption/#docsNav) allows applications to encrypt messages at producers and decrypt messages at consumers.
   ```

##########
File path: site2/docs/client-libraries-python.md
##########
@@ -288,3 +288,103 @@ class Example(Record):
     a = String()
     sub = MySubRecord()
 ```
+
+## End-to-end encryption
+
+[End-to-end encryption](https://pulsar.apache.org/docs/en/next/cookbooks-encryption/#docsNav) allows applications to encrypt messages at producers and decrypt at consumers.
+
+### Configuration
+
+If you want to use the end-to-end encryption feature in the Python client, you need to configure `publicKeyPath` and `privateKeyPath` for both producer and consumer.

Review comment:
       ```suggestion
   To use the end-to-end encryption feature in the Python client, you need to configure `publicKeyPath` and `privateKeyPath` for both producer and consumer.
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Posted by GitBox <gi...@apache.org>.
Jennifer88huang commented on a change in pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707#discussion_r583331344



##########
File path: site2/docs/client-libraries-python.md
##########
@@ -288,3 +288,103 @@ class Example(Record):
     a = String()
     sub = MySubRecord()
 ```
+
+## End-to-end encryption
+
+[End-to-end encryption](https://pulsar.apache.org/docs/en/next/cookbooks-encryption/#docsNav) allows applications to encrypt messages at producers and decrypt at consumers.
+
+### Configuration
+
+If you want to use the end-to-end encryption feature in the Python client, you need to configure `publicKeyPath` and `privateKeyPath` for both producer and consumer.
+
+```
+publicKeyPath: "./public.pem"
+privateKeyPath: "./private.pem"
+```
+
+### Tutorial
+
+This section provides step-by-step instructions on how to use the end-to-end encryption feature in the Python client.
+
+#### Prerequisite
+
+- Pulsar Python client 2.7.1 or later 
+
+#### Step

Review comment:
       Remove the heading. List the steps directly.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Posted by GitBox <gi...@apache.org>.
Jennifer88huang commented on a change in pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707#discussion_r583331134



##########
File path: site2/docs/client-libraries-python.md
##########
@@ -288,3 +288,103 @@ class Example(Record):
     a = String()
     sub = MySubRecord()
 ```
+
+## End-to-end encryption
+
+[End-to-end encryption](https://pulsar.apache.org/docs/en/next/cookbooks-encryption/#docsNav) allows applications to encrypt messages at producers and decrypt at consumers.
+
+### Configuration
+
+If you want to use the end-to-end encryption feature in the Python client, you need to configure `publicKeyPath` and `privateKeyPath` for both producer and consumer.
+
+```
+publicKeyPath: "./public.pem"
+privateKeyPath: "./private.pem"
+```
+
+### Tutorial
+
+This section provides step-by-step instructions on how to use the end-to-end encryption feature in the Python client.
+
+#### Prerequisite

Review comment:
       Heading is used to make the structure clear, in this case, I don't think we need a heading 4 for the prerequisite. I suggest that we use a "bold font" for prerequisite or a sentence for explain it.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Posted by GitBox <gi...@apache.org>.
Jennifer88huang commented on a change in pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707#discussion_r583331558



##########
File path: site2/docs/client-libraries-python.md
##########
@@ -288,3 +288,103 @@ class Example(Record):
     a = String()
     sub = MySubRecord()
 ```
+
+## End-to-end encryption
+
+[End-to-end encryption](https://pulsar.apache.org/docs/en/next/cookbooks-encryption/#docsNav) allows applications to encrypt messages at producers and decrypt at consumers.
+
+### Configuration
+
+If you want to use the end-to-end encryption feature in the Python client, you need to configure `publicKeyPath` and `privateKeyPath` for both producer and consumer.
+
+```
+publicKeyPath: "./public.pem"
+privateKeyPath: "./private.pem"
+```
+
+### Tutorial
+
+This section provides step-by-step instructions on how to use the end-to-end encryption feature in the Python client.
+
+#### Prerequisite
+
+- Pulsar Python client 2.7.1 or later 
+
+#### Step
+
+1. Create both public and private key pairs.
+
+    **Input**
+
+    ```shell
+    openssl genrsa -out private.pem 2048
+    openssl rsa -in private.pem -pubout -out public.pem
+    ```
+
+2. Create a producer to send encrypted messages.
+
+    **Input**
+
+    ```python
+    import pulsar
+
+    publicKeyPath = "./public.pem"
+    privateKeyPath = "./private.pem"
+    crypto_key_reader = pulsar.CryptoKeyReader(publicKeyPath, privateKeyPath)
+    client = pulsar.Client('pulsar://localhost:6650')
+    producer = client.create_producer(topic='encryption', encryption_key='encryption', crypto_key_reader=crypto_key_reader)
+    producer.send('encryption message'.encode('utf8'))
+    print('sent message')
+    producer.close()
+    client.close()
+    ```
+
+3. Create a consumer to receive encrypted messages.
+
+    **Input**
+
+    ```python
+    import pulsar
+
+    publicKeyPath = "./public.pem"
+    privateKeyPath = "./private.pem"
+    crypto_key_reader = pulsar.CryptoKeyReader(publicKeyPath, privateKeyPath)
+    client = pulsar.Client('pulsar://localhost:6650')
+    consumer = client.subscribe(topic='encryption', subscription_name='encryption-sub', crypto_key_reader=crypto_key_reader)
+    msg = consumer.receive()
+    print("Received msg '{}' id = '{}'".format(msg.data(), msg.message_id()))
+    consumer.close()
+    client.close()
+    ```
+
+4. Run the consumer to receive encrypted messages.

Review comment:
       what does "run the consumer" mean?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet merged pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Posted by GitBox <gi...@apache.org>.
Anonymitaet merged pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #9707: [Doc] Add descriptions of end-to-end encryption for Python client

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #9707:
URL: https://github.com/apache/pulsar/pull/9707#issuecomment-786333589


   @Huanli-Meng thanks, I've incorporated, PTAL


----------------------------------------------------------------
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:
users@infra.apache.org