Hi, I have the following encryption code:
Dim encryptedKey As String = nothing
<WebMethod()> Public Function Encrypt(ByVal password As String) As String
Dim bEncryptedData() As Byte
Dim rsaCSP As RSACryptoServiceProvider
Dim bInput() As Byte
Dim paramCSP As CspParameters
paramCSP = New CspParameters()
paramCSP.Flags = CspProviderFlags.UseMachineKeyStore
rsaCSP = New RSACryptoServiceProvider(paramCSP)
bInput = (New System.Text.UnicodeEncoding()).GetBytes(password)
encryptionKey = rsaCSP.ToXmlString(True)
bEncryptedData = rsaCSP.Encrypt(bInput, False)
Encrypt = (New System.Text.UnicodeEncoding()).GetString(bEncryptedData).ToString()
End Function
This works great, it generates a key and the pwd which I can then store in our DB, however, what I want to do now is use the existing key from the DB to encrypt another PWD to see if they match -- any idea how I can get the above code to use the encryptedKey string as teh encryption key??? ( I realise there are other password encryption methods but I have been playing with this one for too ling to give up now :) )
Cheers
Magnus