0

i know php well but not ts i have a code in server in php

header("Access-Control-Allow-Origin: *");
define('AES_256_CBC', 'aes-256-cbc');
$encryption_key = ".........";

$iv = ".........";      
$encrypted= str_replace( " " ,"+",$_GET['data'] );

$encrypted = $encrypted . ':' . base64_encode($iv);

$parts = explode(':', $encrypted);

$decrypted = openssl_decrypt($parts[0], AES_256_CBC, $encryption_key, 0, base64_decode($parts[1]));

how can i implate it in typescript?

Arash Soft
  • 11
  • 5
  • This can help you https://www.npmjs.com/package/crypto-js – Neha Shah Apr 10 '20 at 05:07
  • @NehaShah i did not get it how to use to decrypt a input – Arash Soft Apr 10 '20 at 23:26
  • @NehaShah would you please give me a example? – Arash Soft Apr 10 '20 at 23:26
  • @NahaShah i made service as instruction here: https://stackoverflow.com/questions/45068925/how-to-use-cryptojs-with-angular-4 but one problem is there is not input for iv also i try to Decryption at here : https://www.devglan.com/online-tools/aes-encryption-decryption but it can not work and Decrypt data – Arash Soft Apr 11 '20 at 00:29
  • https://stackoverflow.com/a/57572385/12917651 is a working example and iv will be the value which you want to encrypt like token or anything [ object, array, string] – Neha Shah Apr 13 '20 at 06:20

0 Answers0