0
我一直试图使用我的私有RSA密钥进行加密,并使用我的公共RSA密钥进行解密,但是我无法解密没有得到“Decrypt():Key not valid用于指定的状态。“VB.net如何使用RSA的私钥进行加密
哦,我意识到你通常使用公钥加密 - 这不是我想要做的。请不要通过“了解PKE的工作原理”发送垃圾邮件
我需要的是能够在我的计算机上加密补丁(大约200字节的base 64文本),然后让程序解密公钥,证明我做了补丁。 我可以得到一些帮助,或者你知道任何可以使这更容易的库吗?
解密功能:
Public Shared Function Decrypt(ByVal Data() As Byte, ByVal Privatekey As String) As RSAResult
Try
Dim RSA As System.Security.Cryptography.RSACryptoServiceProvider = New System.Security.Cryptography.RSACryptoServiceProvider()
RSA.FromXmlString(Privatekey)
Dim Result As New RSAResult(RSADecrypt(Data, RSA.ExportParameters(True), False))
Return Result
Catch ex As Exception
Throw New Exception("Decrypt(): " & ex.Message, ex)
End Try
End Function
您的使用案例需要调用加密[签名](http://en.wikipedia.org/wiki/Digital_signature)算法。 – ntoskrnl