9

Encryption Decryption User Details Using Crypto-JS Library to secure application...

 2 years ago
source link: https://dev.to/deepakjaiswal/encryption-decryption-user-details-using-crypto-js-library-to-secure-application-in-react-2ge8
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for Encryption Decryption User Details Using Crypto-JS Library to secure application in React
Deepak

Posted on Jan 15

Encryption Decryption User Details Using Crypto-JS Library to secure application in React

hello developers today we talk about a library named is crypto-js
so why we use this library in our development.
because it secure aur informaion from malicius user.

It encrypt our information in cipher text. and we decrypt that text in our
servers file to verify on behalf of secret key.

npm install crypto-js --save

encrypt information

var CryptoJS = require("crypto-js");

// Encrypt
var ciphertext = CryptoJS.AES.encrypt('user info', 'secret key').toString();


Enter fullscreen mode

Exit fullscreen mode

Decrypt information

var CryptoJS = require("crypto-js");
var bytes  = CryptoJS.AES.decrypt(ciphertext, 'secret key');
var originalText = bytes.toString(CryptoJS.enc.Utf8);

Enter fullscreen mode

Exit fullscreen mode

The main reason using this library because some use check their history to see their payload on login time user inter into the login form. so we can use crypto library to secure application


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK