Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:PEM格式密钥怎么处理啊

1楼
aidimeng 发表于:2025/1/1 13:15:00
Dim rsa = New System.Security.Cryptography.RSACryptoServiceProvider()
Dim ByteConverter As New UnicodeEncoding()
'Dim dataToEncrypt As Byte() = ByteConverter.GetBytes("ww我wData to Encrypt")
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2KbR4DybAGoFvZleBqdHtnX03Bf2CvzsdCZf8/t5mNsISlKdkRVeqc7JimvHny7sICCMmmWZYu33ZzJkDXSKB8JDM2hugwB3Von8aWiMYxKjq43Hn0vfv7M+70WjX0TNGoyMFLKSN9rsqMtIAuD+Ipv6Aovlw+1PjGMPZ2XtUbB010/JEP7d1NjyKxKhFryKzBOc4FhNfis6EJIpsFnA1LKIvg/Mw0BY/f9u6lafCPR+OO4Ula4PShV1nD3TfNYlWNCocZtxVlVfqR78c0Tpe2+jkG8BEtylzff2olEf0z+YwxqyOdHxutMlEnoYa16kkqpc+IRdeaGhcKSwpKvk4QIDAQAB
Dim dataToEncrypt As String = "784e9291-e51f-4b12-900e-3736b0d401f3"
Dim pck As String = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2KbR4DybAGoFvZleBqdHtnX03Bf2CvzsdCZf8/t5mNsISlKdkRVeqc7JimvHny7sICCMmmWZYu33ZzJkDXSKB8JDM2hugwB3Von8aWiMYxKjq43Hn0vfv7M+70WjX0TNGoyMFLKSN9rsqMtIAuD+Ipv6Aovlw+1PjGMPZ2XtUbB010/JEP7d1NjyKxKhFryKzBOc4FhNfis6EJIpsFnA1LKIvg/Mw0BY/f9u6lafCPR+OO4Ula4PShV1nD3TfNYlWNCocZtxVlVfqR78c0Tpe2+jkG8BEtylzff2olEf0z+YwxqyOdHxutMlEnoYa16kkqpc+IRdeaGhcKSwpKvk4QIDAQAB"
Dim encryptedData() As Byte
Dim decryptedData() As Byte
Dim gs As String = "<RSAKeyValue><Modulus>" & pck & "</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"'rsa.ToXmlString(False) '生成 公匙
Output.Show(gs)
Dim ss As String = rsa.ToXmlString(True) ''生成 私匙
rsa.FromXmlString(gs) '公匙
encryptedData = RSA.Encrypt(encoding.UTF8.GetBytes(DataToEncrypt), False)
'output.show("加密后:" & ByteConverter.GetString(encryptedData))
output.show("加密后:" & convert.ToBase64String(encryptedData))
'rsa.FromXmlString(ss)
'decryptedData = RSA.Decrypt(encryptedData, False)
'output.show("解密后: " & encoding.UTF8.Getstring(decryptedData))

遇到的问题;对方给了指定的密钥 pck ,如果不构造成 <RSAKeyValue><Modulus>" & pck & "</ 这样 程序报错,我这样构造下,可以加密,但得到的结果和在线加密得到的结果不一样
图片点击可在新窗口打开查看
[此贴子已经被作者于2025/1/1 17:18:37编辑过]
2楼
有点蓝 发表于:2025/1/2 8:44:00
接口开发文档发过来看看
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .10938 s, 2 queries.