diff --git a/.DS_Store b/.DS_Store index 73041bc..2428609 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/utilities/signing_and_verification/node/index.js b/utilities/signing_and_verification/node/index.js new file mode 100644 index 0000000..c306797 --- /dev/null +++ b/utilities/signing_and_verification/node/index.js @@ -0,0 +1,31 @@ +const nacl = require("tweetnacl"); +const { randomBytes } = require("crypto"); + +function generateKeyPairs() { + // Generate signing key pair + const signingKeyPair = nacl.sign.keyPair(); + + // Generate X25519 key pair for encryption + const encryptionKeyPair = nacl.box.keyPair.fromSecretKey( + randomBytes(nacl.box.secretKeyLength) + ); + + return { + Signing_private_key: Buffer.from(signingKeyPair.secretKey).toString( + "base64" + ), + Signing_public_key: Buffer.from(signingKeyPair.publicKey).toString( + "base64" + ), + Encryption_Privatekey: Buffer.from(encryptionKeyPair.secretKey).toString( + "base64" + ), + Encryption_Publickey: Buffer.from(encryptionKeyPair.publicKey).toString( + "base64" + ), + }; +} + +// Example usage: +const keyPairs = generateKeyPairs(); +console.log(keyPairs); diff --git a/utilities/signing_and_verification/node/package.json b/utilities/signing_and_verification/node/package.json new file mode 100644 index 0000000..537764b --- /dev/null +++ b/utilities/signing_and_verification/node/package.json @@ -0,0 +1,15 @@ +{ + "name": "generate-key-pairs", + "version": "1.0.0", + "description": "This Node.js script generates key pairs for signing and encryption using the `tweetnacl` and `crypto` library.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "crypto": "^1.0.1", + "tweetnacl": "^1.0.3" + } +} diff --git a/utilities/signing_and_verification/node/readme.md b/utilities/signing_and_verification/node/readme.md new file mode 100644 index 0000000..aa7e28e --- /dev/null +++ b/utilities/signing_and_verification/node/readme.md @@ -0,0 +1,50 @@ +# Signing Key pair generation using Node.js + +This Node.js script generates key pairs for signing and encryption using the `tweetnacl` and `crypto` library. + +## Prerequisites + +Make sure you have Node.js installed on your system. If not, you can download it from [Node.js website](https://nodejs.org/). + +## Installation + +```bash +npm i +``` + +## Usage + +- Clone the repository or copy the script into your project. +- Run the script using the following command: + +```bash +node index.js +``` + +## Output + +The script will output key pairs in base64-encoded format for signing and encryption. + +```bash +{ + "Signing_private_key": "BASE64_ENCODED_PRIVATE_KEY", + "Signing_public_key": "BASE64_ENCODED_PUBLIC_KEY", + "Encryption_Privatekey": "BASE64_ENCODED_PRIVATE_KEY", + "Encryption_Publickey": "BASE64_ENCODED_PUBLIC_KEY" +} + +``` + +## Example + +```javascript +const keyPairs = generateKeyPairs(); +console.log(keyPairs); +``` + +Feel free to integrate this script into your project or use it as a reference for key pair generation in Node.js. + +```vbnet +Copy and paste this markdown content into a `readme.md` file in your project repository. Modify it as needed based on your project structure and additional information you want to provide. + +``` diff --git a/utilities/signing_and_verification/README.md b/utilities/signing_and_verification/python/README.md similarity index 100% rename from utilities/signing_and_verification/README.md rename to utilities/signing_and_verification/python/README.md diff --git a/utilities/signing_and_verification/auth_header_signing_and_verification.md b/utilities/signing_and_verification/python/auth_header_signing_and_verification.md similarity index 100% rename from utilities/signing_and_verification/auth_header_signing_and_verification.md rename to utilities/signing_and_verification/python/auth_header_signing_and_verification.md diff --git a/utilities/signing_and_verification/cryptic_utils.py b/utilities/signing_and_verification/python/cryptic_utils.py similarity index 100% rename from utilities/signing_and_verification/cryptic_utils.py rename to utilities/signing_and_verification/python/cryptic_utils.py diff --git a/utilities/signing_and_verification/cryptkey.py b/utilities/signing_and_verification/python/cryptkey.py similarity index 100% rename from utilities/signing_and_verification/cryptkey.py rename to utilities/signing_and_verification/python/cryptkey.py diff --git a/utilities/signing_and_verification/request_body_raw_text.txt b/utilities/signing_and_verification/python/request_body_raw_text.txt similarity index 100% rename from utilities/signing_and_verification/request_body_raw_text.txt rename to utilities/signing_and_verification/python/request_body_raw_text.txt diff --git a/utilities/signing_and_verification/requirements.txt b/utilities/signing_and_verification/python/requirements.txt similarity index 100% rename from utilities/signing_and_verification/requirements.txt rename to utilities/signing_and_verification/python/requirements.txt diff --git a/utilities/signing_and_verification/scratch.py b/utilities/signing_and_verification/python/scratch.py similarity index 100% rename from utilities/signing_and_verification/scratch.py rename to utilities/signing_and_verification/python/scratch.py