From 4bb7f629572e69339881b897f17a580a7e5a321f Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 15:46:14 +0530 Subject: [PATCH 1/8] Update readme.md --- utilities/on_subscibe-service/node/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/on_subscibe-service/node/readme.md b/utilities/on_subscibe-service/node/readme.md index ef7f741..13a0cfa 100644 --- a/utilities/on_subscibe-service/node/readme.md +++ b/utilities/on_subscibe-service/node/readme.md @@ -4,7 +4,7 @@ ``` - PRIVATE_KEY_1 = "NP's encryption private key" -- PUBLIC_KEY_1 = "Registry's encryption public key which is available in NP On-Boarding on Staging doc (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" +- PUBLIC_KEY_1 = "Registry's encryption public key which is available in NP On-Boarding on Staging [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" - REQUEST_ID = "request_id which is sent in /subscribe" - SIGNING_PRIVATE_KEY = "NP's signing private key" ``` From 36c1d32523bfeedd1202e55c36248020a1461b83 Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 15:47:13 +0530 Subject: [PATCH 2/8] Update readme.md From 1fb6653c2a0107bbd3766d3f6439050f4c0ee946 Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 15:49:46 +0530 Subject: [PATCH 3/8] Update README.md --- utilities/signing_and_verification/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/signing_and_verification/README.md b/utilities/signing_and_verification/README.md index dc9777d..1893bf8 100644 --- a/utilities/signing_and_verification/README.md +++ b/utilities/signing_and_verification/README.md @@ -23,16 +23,16 @@ python cryptic_utils.py generate_key_pairs ``` Signing_private_key: G0Pme72u8Y1MwxHqvY4iBW+7VPtJ7dsX7SGs6zZ5yvVIzdRAyHR6YkwHG2ufOE+12lsbJRwBF4Hqd7dUEOZZkg== Signing_public_key: SM3UQMh0emJMBxtrnzhPtdpbGyUcAReB6ne3VBDmWZI= - Crypto_Privatekey: MC4CAQAwBQYDK2VuBCIEIKi7NbXeN8QzXjN48XkjOiS/UaR6rumXep8VslMy4fRU - Crypto_Publickey: MCowBQYDK2VuAyEA9CEWxnLJkmwW/67QR739BEam7bbd3NsffjDa5HANf0Q= + Encryption_Privatekey: MC4CAQAwBQYDK2VuBCIEIKi7NbXeN8QzXjN48XkjOiS/UaR6rumXep8VslMy4fRU + Encryption_Publickey: MCowBQYDK2VuAyEA9CEWxnLJkmwW/67QR739BEam7bbd3NsffjDa5HANf0Q= ``` 4. Export private and public keys ``` export PRIVATE_KEY= export PUBLIC_KEY= -export CRYPTO_PRIVATE_KEY= -export CRYPTO_PUBLIC_KEY= +export ENCRYPTION_PRIVATE_KEY= +export ENCRYPTION_PUBLIC_KEY= ``` 5. Create authorisation header From 06f5213c2de74ce7f2ac8df5a192e719ef951e81 Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 15:58:54 +0530 Subject: [PATCH 4/8] Update cryptic_utils.py --- .../signing_and_verification/cryptic_utils.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/utilities/signing_and_verification/cryptic_utils.py b/utilities/signing_and_verification/cryptic_utils.py index b1ad6fc..cab39c0 100644 --- a/utilities/signing_and_verification/cryptic_utils.py +++ b/utilities/signing_and_verification/cryptic_utils.py @@ -101,7 +101,7 @@ def generate_key_pairs(): #print(private_key) public_key = base64.b64encode(bytes(signing_key.verify_key)).decode() inst_private_key = X25519PrivateKey.generate() - #print(base64.b64encode(bytes(tcrypto_private_key.).decode())) + #print(base64.b64encode(bytes(tencryption_private_key.).decode())) inst_public_key = inst_private_key.public_key() bytes_private_key = inst_private_key.private_bytes( encoding=serialization.Encoding.DER, @@ -112,21 +112,21 @@ def generate_key_pairs(): encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo ) - crypto_private_key = base64.b64encode(bytes_private_key).decode('utf-8') - crypto_public_key = base64.b64encode(bytes_public_key).decode('utf-8') + encryption_private_key = base64.b64encode(bytes_private_key).decode('utf-8') + encryption_public_key = base64.b64encode(bytes_public_key).decode('utf-8') return {"Signing_private_key": private_key, "Signing_public_key": public_key, - "Crypto_Privatekey": crypto_private_key, - "Crypto_Publickey": crypto_public_key} + "Encryption_Privatekey": encryption_private_key, + "Encryption_Publickey": encryption_public_key} -def encrypt(crypto_private_key, crypto_public_key, null): +def encrypt(encryption_private_key, encryption_public_key, null): private_key = serialization.load_der_private_key( - base64.b64decode(crypto_private_key), + base64.b64decode(encryption_private_key), password=None ) public_key = serialization.load_der_public_key( - base64.b64decode(crypto_public_key) + base64.b64decode(encryption_public_key) ) shared_key = private_key.exchange(public_key) cipher = AES.new(shared_key, AES.MODE_ECB) @@ -134,13 +134,13 @@ def encrypt(crypto_private_key, crypto_public_key, null): return base64.b64encode(cipher.encrypt(pad(text,AES.block_size))).decode('utf-8') -def decrypt(crypto_private_key, crypto_public_key, cipherstring): +def decrypt(encryption_private_key, encryption_public_key, cipherstring): private_key = serialization.load_der_private_key( - base64.b64decode(crypto_private_key), + base64.b64decode(encryption_private_key), password=None ) public_key = serialization.load_der_public_key( - base64.b64decode(crypto_public_key) + base64.b64decode(encryption_public_key) ) shared_key = private_key.exchange(public_key) cipher = AES.new(shared_key, AES.MODE_ECB) From 261d138955117f38340a26e41f65a4b82db655ad Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:10:18 +0530 Subject: [PATCH 5/8] Update readme.md --- utilities/on_subscibe-service/node/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/on_subscibe-service/node/readme.md b/utilities/on_subscibe-service/node/readme.md index 13a0cfa..e1d7433 100644 --- a/utilities/on_subscibe-service/node/readme.md +++ b/utilities/on_subscibe-service/node/readme.md @@ -4,7 +4,7 @@ ``` - PRIVATE_KEY_1 = "NP's encryption private key" -- PUBLIC_KEY_1 = "Registry's encryption public key which is available in NP On-Boarding on Staging [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" +- PUBLIC_KEY_1 = "Registry's encryption public key which is available in NP On-Boarding on [Staging](url) [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" - REQUEST_ID = "request_id which is sent in /subscribe" - SIGNING_PRIVATE_KEY = "NP's signing private key" ``` From 8d924ef1aef10a75a834fca3460c62a5f5aaa9c0 Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:23:05 +0530 Subject: [PATCH 6/8] Update readme.md --- utilities/on_subscibe-service/node/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities/on_subscibe-service/node/readme.md b/utilities/on_subscibe-service/node/readme.md index e1d7433..1884776 100644 --- a/utilities/on_subscibe-service/node/readme.md +++ b/utilities/on_subscibe-service/node/readme.md @@ -1,12 +1,12 @@ + # Subscribing to ONDC Registry 1. Add following constants like below. -``` - PRIVATE_KEY_1 = "NP's encryption private key" -- PUBLIC_KEY_1 = "Registry's encryption public key which is available in NP On-Boarding on [Staging](url) [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" +- PUBLIC_KEY_1 = "Registry's encryption public key as per your environment which is available in NP On-Boarding on [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" - REQUEST_ID = "request_id which is sent in /subscribe" - SIGNING_PRIVATE_KEY = "NP's signing private key" -``` + 2. Place the index.js file code into your main file, and this utility will host the on_subscribe endpoint as well as html file. From bef41d87a4c3171e5e6801c45b24a22897b7c54c Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:24:18 +0530 Subject: [PATCH 7/8] Update readme.md --- utilities/on_subscibe-service/node/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/on_subscibe-service/node/readme.md b/utilities/on_subscibe-service/node/readme.md index 1884776..7120fb6 100644 --- a/utilities/on_subscibe-service/node/readme.md +++ b/utilities/on_subscibe-service/node/readme.md @@ -3,8 +3,8 @@ 1. Add following constants like below. -- PRIVATE_KEY_1 = "NP's encryption private key" -- PUBLIC_KEY_1 = "Registry's encryption public key as per your environment which is available in NP On-Boarding on [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" +- ENCRYPTION_PRIVATE_KEY = "NP's encryption private key" +- ONDC_PUBLIC_KEY = "Registry's encryption public key as per your environment which is available in NP On-Boarding on [document](https://github.com/ONDC-Official/developer-docs/blob/main/registry/Onboarding%20of%20Participants.md) (staging key: MCowBQYDK2VuAyEAduMuZgmtpjdCuxv+Nc49K0cB6tL/Dj3HZetvVN7ZekM=)" - REQUEST_ID = "request_id which is sent in /subscribe" - SIGNING_PRIVATE_KEY = "NP's signing private key" From c6b312015e5626120174318e77b3adf44a730394 Mon Sep 17 00:00:00 2001 From: nishthamongaondc <150439595+nishthamongaondc@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:24:52 +0530 Subject: [PATCH 8/8] Update index.js --- utilities/on_subscibe-service/node/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/on_subscibe-service/node/index.js b/utilities/on_subscibe-service/node/index.js index 5b98381..58e384f 100644 --- a/utilities/on_subscibe-service/node/index.js +++ b/utilities/on_subscibe-service/node/index.js @@ -5,9 +5,9 @@ const crypto = require('crypto'); // Node.js crypto module for encryption and de const _sodium = require('libsodium-wrappers'); const port = 3000; // Port on which the server will listen -const PRIVATE_KEY_1 = +const ENCRYPTION_PRIVATE_KEY = 'MC4CAQEwBQYDK2VuBCIEILgcht9h660ZeO36tG+QuHGNcLN9JuAzxHWZl09f57Bh'; -const PUBLIC_KEY_1 = +const ONDC_PUBLIC_KEY = 'MCowBQYDK2VuAyEAlKHWJWiEiHFGlAJ6TE4VMGaeQUYg5DHEpuQdiq6flnQ='; const REQUEST_ID = '6a6abf53-674f-4d6d-a52b-62e3fda55e04'; const SIGNING_PRIVATE_KEY =