首页 > php教程 > php手册 > RSA PHP 转C#

RSA PHP 转C#

WBOY
发布: 2016-06-06 19:40:50
原创
1209 人浏览过

现在我知道PHP中RSA的公钥和私钥,但貌似C#的RSA中用公钥加密的结果不一致,求指导怎么转,还有就是私钥的话C#还需要很多个其他因子. PHP中公钥格式: $pubKey = '-----BEGIN PUBLIC KEY----- UFOfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCivaicGCwPqH4cyy7S9DoN

现在我知道PHP中RSA的公钥和私钥,但貌似C#的RSA中用公钥加密的结果不一致,求指导怎么转,还有就是私钥的话C#还需要很多个其他因子.

PHP中公钥格式:

$pubKey = '-----BEGIN PUBLIC KEY-----
UFOfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCivaicGCwPqH4cyy7S9DoNrlPF
AFcGrontMObMsoiXXXXXXXXXXXXXXXXXXXXXXLy7+KkElP48MyGlwIQAtNauC8
4lc+TOkyY22u/nIss5wHfG8FbsdT18xmG6F6C+3oAPKYKWd9pkLVKTyM3oN52bUg
O6YBBCC8lw0ukzrZkQIDAQAB
-----END PUBLIC KEY-----';

PHP私钥格式:

$priKey = '-----BEGIN RSA PRIVATE KEY-----
UTOCXAIBAAKBgQCivaicGCwPqH4cyy7S9DoNrlPFAFcGrontMObVsoiJarp8cKYY
rvmCE95vExWuWbbLy7+KkElP48MyGlwIQAtNauC84lc+TOkyY22u/nIss5wUfG8F
bsdT18xmG6F6C+3oAPKYM3oN52bUgO6YBBCC8lw0ukzrZkQIDAQAB
AoGBAJf7Lz+3g06MOFqDlhMEakLkjuQdCzZ/KOvMdKRKP5PFtNY53/0z
gYf12LSybwrkfNLTDjP4UgKSbPo+Wsw+lC9ahCbhhGHZ5wLkKInLKfXfxRL17j7r
fIBKlvYGlai78bTdR+/iTBAkEA07427OGtiic6
dsWfp/fskdS3HJEkFhzwPNtlfsHigT92U/AbzzjuzEdv3oU5uZp7qHwzPzumoDnD
ON47Vz6oJQJBAMTBeRZETTChvSRFfrhw+W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IzKSCwB8M2G7Qv9xgZQaQlLpCaeKbux3Y59hHM+KpamGL19Kg==
 vmaYHEbPAgOJvaEXQl+t8DQKFT1fudEysTy31LTyXjGu6XiltXXHUuZaa2IPyHgBz0Nd7znwsW/S44iql0Fen1kzKioEL3svANui63O3o5xdDeExVM6zOf1wUUh/oldovPweChyoAdMtUzgvCbJk1sYDJf++Nr0FeNW1RB1XG30=

 

请问只知道PHP的公钥和私钥的情况下如何转成C#版的。

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板