Breaking News: Grepper is joining
You.com.
Read the official announcement!
Check it out
SEARCH
COMMUNITY
API
DOCS
INSTALL GREPPER
Log In
Signup
Encrypt in PHP openssl and decrypt in javascript CryptoJS
Add Answer
Australian Spiny Anteater
answered on
November 26, 2019
Popularity
9/10
Helpfulness
4/10
Contents
answer
Encrypt in PHP openssl and decrypt in javascript CryptoJS
related
Encrypt in PHP openssl and decrypt in javascript CryptoJS
related
encrypt decrypt php javascript
related
Encrypt in PHP openssl and decrypt in javascript CryptoJS
related
Encrypt in PHP openssl and decrypt in javascript CryptoJS
More Related Answers
cryptojs decrypt
openssl_encrypt
encrypt decrypt in vanilla javascript
encrypt decrypt javascript
php encrypt and decrypt
openssl encrypt php with key
encrypt/decrypt data php
javascript string encryption and decryption
encrypt in js
encrypt in JS using AES Algorithm
encrypt decrypt php
encryption and decryption in php example
encrypt js
javascript encrypt decrypt
javaScript encryption decryption
js encrypt and decrypt
Symmetric decryption in PHP
php encrypt decrypt url parameters
nodejs encrypt
encryption decryption in javascript
php encrypt message encrypt() decrypt
php script to encrypt an input
encrypt and decrypt in js
encrypt decrypt php
encrypt decrypt php
Encrypt in PHP openssl and decrypt in javascript CryptoJS
Comment
0
function CryptoJSAesDecrypt(passphrase,encrypted_json_string){ var obj_json = JSON.parse(encrypted_json_string); var encrypted = obj_json.ciphertext; var salt = CryptoJS.enc.Hex.parse(obj_json.salt); var iv = CryptoJS.enc.Hex.parse(obj_json.iv); var key = CryptoJS.PBKDF2(passphrase, salt, { hasher: CryptoJS.algo.SHA512, keySize: 64/8, iterations: 999}); var decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv}); return decrypted.toString(CryptoJS.enc.Utf8); } console.log(CryptoJSAesDecrypt('your passphrase','<?php echo $string_json_fromPHP?>'));
Popularity
9/10
Helpfulness
4/10
Language
php
Source:
Grepper
Tags:
cryptojs
javascript
php
php-openssl
Share
Link to this answer
Share
Copy Link
Contributed on Nov 26 2019
Australian Spiny Anteater
0 Answers Avg Quality 2/10
Closely Related Answers
Encrypt in PHP openssl and decrypt in javascript CryptoJS
Comment
0
function CryptoJSAesEncrypt($passphrase, $plain_text){ $salt = openssl_random_pseudo_bytes(256); $iv = openssl_random_pseudo_bytes(16); //on PHP7 can use random_bytes() istead openssl_random_pseudo_bytes() //or PHP5x see : https://github.com/paragonie/random_compat $iterations = 999; $key = hash_pbkdf2("sha512", $passphrase, $salt, $iterations, 64); $encrypted_data = openssl_encrypt($plain_text, 'aes-256-cbc', hex2bin($key), OPENSSL_RAW_DATA, $iv); $data = array("ciphertext" => base64_encode($encrypted_data), "iv" => bin2hex($iv), "salt" => bin2hex($salt)); return json_encode($data); } $string_json_fromPHP = CryptoJSAesEncrypt("your passphrase", "your plain text");
Popularity
9/10
Helpfulness
4/10
Language
php
Source:
Grepper
Tags:
cryptojs
cryptoj
Share
Link to this answer
Share
Copy Link
Contributed on Nov 26 2019
Australian Spiny Anteater
0 Answers Avg Quality 2/10
encrypt decrypt php javascript
Comment
0
Betiel
Popularity
1/10
Helpfulness
1/10
Language
php
Source:
Grepper
Tags:
javascript
php
Share
Link to this answer
Share
Copy Link
Contributed on Aug 13 2021
Delightful Duck
0 Answers Avg Quality 2/10
Encrypt in PHP openssl and decrypt in javascript CryptoJS
Comment
0