我正在开展一个包含不同方之间的加密和解密的项目。
密钥是使用' phpseclib'生成的。 (https://github.com/phpseclib/phpseclib/tree/master/phpseclib/Crypt)在使用RSA类的远程服务器上。
密钥的格式如下:
公开:
-----BEGIN RSA PUBLIC KEY-----
MIGIAoGAUEAW3K4+77Q1XrbdE/Sat7l9LXcD8qUdDGzSMubWXARMj8xtaPnVj7Ec
81HU5lKbFO31tV9nPSNeApNkkZtQhxx0Gz2gQgiChiuhcmlmNdnzEXFFpwa+uo2i
fR5BLkNNy+qldhLqHg6yK7y0CrMKJUjfH2PKU+a5VectKkxPmDsCAwEAAQ==
-----END RSA PUBLIC KEY-----
个人:
-----BEGIN RSA PRIVATE KEY-----
MIIDHQIBAQKBgFBAFtyuPu+0NV623RP0mre5fS13A/KlHQxs0jLm1lwETI/MbWj5
1Y+xHPNR1OZSmxTt9bVfZz0jXgKTZJGbUIccdBs9oEIIgoYroXJpZjXZ8xFxRacG
vrqNon0eQS5DTcvqpXYS6h4Osiu8tAqzCiVI3x9jylPmuVXnLSpMT5g7AgMBAAEC
gYAb/L38aKh6XjDbXb2jFVQ3sxx3EQACbVVKo1e3LQY+YrMjSGsKS2TAbiMaNebF
7RPRFQfJ2gWSshDj0oCPg0U7WkEsFla5gIl3zJrVbeNnC9jyzZ/LgCnZIKiDcMXv
r0plq6HxcHJWcHecpKhfzvfmd26/U6DhL0kP54FWOf8AAQIJAIEyQC7c5gxXAgkA
5JFBPI+4/msCCD80lE3Y5/rVAgkApkPHeb9uqZsCCATuDv0RSFtXMIIB1jAfAgkA
uKLVRgl4zqkCCAae4CLoyAoxAggHXPQwQgmTOTAhAgkA6CnMpA9djC0CCQCBPmPS
IUuusQIJANRRQ8thKK4UMB8CCQC1KlBjMihEawIIGOMeNfJO+88CCHdqK2B+eQLs
MB8CCQC4HwiUnQVuLQIIaOjV3MfzdikCCHI4iaUvtcqGMB8CCQCUKg9il+fkPQII
VDo01M+WO+ECCEq17+pHX2OtMB8CCQCIZvXiOx/PbwIISPda/URHhf0CCFsVg61b
83D6MCACCQCwPqvRmoiStwIJAKF1mKSaJLn7Agh2FqM8iF6xmjAfAgkAlGuCK9lO
/IMCCCKkiWi0u1QDAggnJIDr4YyD3jAfAgkAhL2jhjw0DKsCCETMxeTdb1zhAghQ
V9S+12JvPzAfAgkA+6wy7oV1aocCCC3YBkcQpHzNAghOrrC+Nc3tgTAgAgkAxDf5
kZMTkUcCCQCqYJg5yWWyPQIIF1zKmIUwDGQwIAIJALbjlmSjpLg9AgkAqRV0P4sD
iMkCCAH9Ncvav/KFMCACCQDpSAEmE4WkowIIMH6/fmLgjXECCQCYz0JvH95z5DAh
AglCvzjdoEVfNPcCCT/8Id5LatUm5wIJCrp28jLZ/NOw
-----END RSA PRIVATE KEY-----
我试图使用' RSACryptoServiceProvider'对于加密和解密,但我无法找到将PEM格式转换为RSA加密服务提供商所需的XML格式的方法。
有什么建议怎么办?
谢谢!