I am trying to decrypt the cipher which i take from my jailbroken iphone but I don't know why the RNCryptor decrypt function always return null value when I put the $_get value to function, but it is worked fine when I put the raw data to decrypt function. Anyone have idea about this problem? This is the code which is return null value:
if(isset($_GET['info'])){
$password = "mykey"
$base64Encrypted = $_GET['info'];
$cryptor = new \RNCryptor\Decryptor();
$plaintext = $cryptor->decrypt($base64Encrypted, $password);
echo $plaintext;//=> this code block return null value
}else{
echo 'not have info params';
}
But when i put raw cipher data this codeblock running well:
if(isset($_GET['info'])){
$password = "mykey"
$base64Encrypted = 'AwEEeG/CU0VHXVGvuRcm805DvvVQi32NPjmlQxoaniIL9ngCjNY1Su4jEb2IfCILBvhKIdjl1znysm6SMiFmRZi2St8wCcWCmnImdwAPLysB/g==';
$cryptor = new \RNCryptor\Decryptor();
$plaintext = $cryptor->decrypt($base64Encrypted, $password);
echo $plaintext;//=> this code block return the original value of cipher
}else{
echo 'not have info params';
}
Sorry, I just firgure out that the $_get param just being encoded when send through URL so all '+' character has been change to space character. This is my solution:
$password = "mykey";
$stringCipher = explode('?info=', $_SERVER['REQUEST_URI'], 2);
$base64Encrypted = $stringCipher[1];
$cryptor = new \RNCryptor\Decryptor();
$decryptSerial = $cryptor->decrypt($base64Encrypted, $password);