crypto__WEBPACK_IMPORTED_MODULE_13__.createDecipheriv is not a function

Viewed 132

I am getting error for decrypting data in angular using crypto. I am attaching screenshot of error for your reference. I have tried with different approaches but not able to resolve this error. I really appreciate your kindness and support. Thanks in advance!

TypeError: crypto__WEBPACK_IMPORTED_MODULE_13__.createDecipheriv is not a function
    at MapSubscriber.decryptData [as project] (common.service.ts:285)
    at MapSubscriber._next (map.js:29)
    at MapSubscriber.next (Subscriber.js:50)
    at XMLHttpRequest.onLoad (http.js:1263)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:21816)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:496)
    at invokeTask (zone.js:1540)
    at XMLHttpRequest.globalZoneAwareCallback (zone.js:1566)

Code in service file:

  let decipher = crypto.createDecipheriv(algorithm, Buffer.from(res.key,'hex'), iv);
  let decrypted = decipher.update(encryptedText);
0 Answers
Related