douwen1915 2016-06-25 15:26
浏览 41
已采纳

php无法解密RNCryptor上$ _get请求的密码

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';
}
  • 写回答

1条回答 默认 最新

  • doushi6947 2016-06-25 16:58
    关注

    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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?