Required Namespace:
Imports System.Security
Imports System.Security.Cryptography
Imports System.Text
And the function:
Private Function RSA_Encrypt(ByVal key As String) As String
Dim myRSAProvide As New RSACryptoServiceProvider()
Dim strByte() As Byte
Dim strResult() As Byte
strByte = Encoding.ASCII.GetBytes(key)
strResult = myRSAProvide.Encrypt(strByte, False)
Return Encoding.ASCII.GetString(strResult)
End Function
Happy Coding!




