Skip to main content

Posts

Showing posts with the label Angular 7 CryptoJS Encrypt Decrypt a String

Encryption Decryption a String in Angular 7 or 8 or 9 - CryptoJS, TypeScript

How to use CryptoJS for data secure using  Encryption Decryption  in Angular? Follow the below steps to achieve this Encryption/Decryption Angular 7, 8 or  9 1.       Install CryptoJS using below commands in your project directory 2.       Add script “ ../node_modules/crypto-js/crypto-js.js ” in your “ angular.json ” file’s scripts array. 3.       Create a service class “ EncrDecrService ” for encrypts and decrypts get/set methods and import “ CryptoJS ” in the service for using encrypt and decrypt get/set methods. 4.       Import this service class “ EncrDecrService ” in the angular module class “ NgModule ” and then add this service in the providers. 5.       Finally, use your encrypted and decrypted service methods in your component class. 6.       Result in your application browser console. Example: See the exampl...