Dim rsa = new System.Security.Cryptography.RSACryptoServiceProvider()
Dim ByteConverter As New UnicodeEncoding()
Dim dataToEncrypt As Byte() = ByteConverter.GetBytes("ww我wData to Encrypt")
Dim encryptedData() As Byte
Dim decryptedData() As Byte
Dim gs As String = rsa.ToXmlString(False) '生成 公匙
Dim ss As String = rsa.ToXmlString(True) ''生成 私匙
rsa.FromXmlString(gs) '公匙
encryptedData = RSA.Encrypt(DataToEncrypt, False)
output.show("加密后:" & ByteConverter.GetString(encryptedData ))
rsa.FromXmlString(ss)
decryptedData= RSA.Decrypt(encryptedData, False)
output.show("解密后: " & ByteConverter.GetString(decryptedData))
自己搞定了!
[此贴子已经被作者于2018/1/3 8:32:32编辑过]
如果要求 密钥是 PEM 格式呢?
对方给了个 pem格式密钥 怎么修改下程序呢
[此贴子已经被作者于2025/1/1 13:13:09编辑过]