最近有一个项目,对方提供了一个公钥,要求按照rsa加密的方式传输url参数。然后还得能够接收对方回复的加密数据,并解密。实在是难倒了,求高人指点一二,不胜感谢!

解决方案 »

  1.   

    可以用这个 http://phpseclib.sourceforge.net/<?php
    include('Crypt/RSA.php');$privatekey = file_get_contents('private.key');$rsa = new Crypt_RSA();
    $rsa->loadKey($privatekey);$plaintext = new Math_BigInteger('aaaaaa');
    echo $rsa->_exponentiate($plaintext)->toBytes();
    ?>
      

  2.   

    http://www.php.net/manual/en/function.openssl-pkey-new.php看看 手册下面大家的推荐吧,phpseclib最好用。