Giter Site home page Giter Site logo

anilspgangani04 / hybrid-cryptography-nodejs Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 64 KB

nodejs rest api - symmetric and asymmetrical encryption

Shell 39.98% JavaScript 60.02%
hybrid-cryptography hybrid-encryption nodejs security aes decryption encryption javascript rsa

hybrid-cryptography-nodejs's Introduction

Hybrid Cryptography Example

What is Hybrid Cryptography?

This project's source code combines symmetric and asymmetrical encryption. This process is referred to as hybrid cryptography.

This paradigm is helpful if we need to encrypt data during client-server communication. The NodeJS rest-api and mobile/web applications will communicate using encryption. We can therefore see that the data they are sending to one another is encrypted.

How to run this example project?

There are two subdirectory clientSide & serverSide. You need to go first client & then server as mentioned below.

clientSide

Run below command and get values for aesString, encryptedData and generatedAsymmetricKey

cd clientSide
npm install
cp .env.example .env
node index.js

this will return something like below

aesString----> TYhxnZ4F6kbmQJ2hFXHvzWrMjFQaFrO6pGvFHuW/HLc=

encryptedData----> U2FsdGVkX1/zrOE2MVtf/VzmdstCS4itQh3EFRvLTHmxwnPaMSkqJU2rnUAhZAVX9LlEX0X04oVktAqRIpHbon5r3dumO2kz7D/d6NDrtmEQZxJH3Qh9FQ50tBJPoOOb861+2F+tLOP5fFnetp7t36hpC5s9doaZNo5ighqz0RnyTI8QNuWDzU87Ht5KLeXG

generatedAsymmetricKey----> L3m4+raJwXZPXKFoNHt0RtxVJWiEC7uxJJWovrKy+21paLN3TfEB1OtLzzntCLoXVMcKYL8Ey5YpVw37dS0x9ooUFPvPAOZMVhM/v4V2bUkO6prdU06J6Im+QCQplBNAhMm77404r0YA9uHyM/yCVM78hp8A35VKjxsjojEHGM8=

serverSide

cd serverSide
npm install
cp .env.example .env
node index.js

The server will now launch. You must use the post method to make an api call to http://localhost:3000/decryptDataFromServer with body json data as the key & data. Think about the data from encryptedData and the key parameter value from generatedAsymmetricKey.

Notes

  • In this example, I only covered the part of what client sends data to server and how server decrypt that data only. Vice versa technique can be helpful to send encrypted data from server to client and client can decrypt those data.
  • Attached diagram image(diagram-image.png) for exiting method.

hybrid-cryptography-nodejs's People

Contributors

anilspgangani04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.