A
A
Alexander Bublikov2017-09-18 02:53:29
PHP
Alexander Bublikov, 2017-09-18 02:53:29

Encryption in Javascript ("Cryptico") and decryption in PHP how to implement?

Good afternoon everyone, I use Javascript ("Cryptico") for data encryption on the client side based on RSA AES and BCB
Private and public key, how to encrypt data and decrypt data encrypted on the client side using PHP ?

var PassPhrase = "The Moon is a Harsh Mistress."  // Пароль 
var Bits = 1024;   // битность ключа
var MattsRSAkey = cryptico.generateRSAKey(PassPhrase, Bits);  // создание ключа
var PlainText = "Matt, I need you to help me with my Starcraft strategy";  //текст который нужно зашифровать
var MattsPublicKeyString = cryptico.publicKeyString(MattsRSAkey);   //получение публичного ключа
var EncryptionResult = cryptico.encrypt(PlainText, MattsPublicKeyString);  // Результат шифрования
var CipherText = EncryptionResult.cipher;   //Шифрованные текст
var DecryptionResult = cryptico.decrypt(CipherText, MattsRSAkey);   //результат дешефровки

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2017-09-18
@xmoonlight

php.net/manual/en/function.openssl-public-decrypt.php

if (openssl_public_decrypt(base64_decode($_POST["CipherText"]), $data, base64_decode($_POST["MattsRSAkey"]))) echo $data; 
else echo 'Ошибка!';

Maybe this will help:
1. https://stackoverflow.com/questions/16505963/encry...
2. https://stackoverflow.com/questions/43420940/opens...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question