dongliao6777 2010-04-24 15:40
浏览 72

RSA加密PHP中的字符串并将其传递给.NET服务的问题

I need to call a web service that requires a login url containing an RSA encrypted, base_64 encoded and url-encoded login data. I don't have a formal php training, but even for me it seems like an easy task, however when calling the service I get an 'Invalid Format' response. What am I doing wrong and is there another way to come up with the encrypted string? Code example below. Thank you for your help!

require 'rsa.php'; // Uses rsa.php from http://www.edsko.net/misc/ for encryption.

$message = '?id=112233&param1=hello&email=hello@world.net&name=Name';

$keyLength = '2048';
$exponent = '65537';
$modulus = '837366556729991345239927764652........';
$encryptedData = rsa_encrypt($message, $exponent, $modulus, $keyLength);
$data = urlencode(base64_encode($encryptedData));

$loginurl = 'http://www.somedomain.com/LoginWB.aspx?Id=9876&Data='.$data;
echo '<iframe src="'.$loginurl.'" width="570px" height="800px">';
echo '</iframe>';
  • 写回答

1条回答 默认 最新

  • dpn517111 2010-04-24 17:42
    关注

    The encryption looks correct to me. Are you sure the server is not complaining about the '?' in the $message?

    If you care about performance, you should use openssl extensions. The public key operations are very slow in PHP.

    评论

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏