我在 VB6 中使用 ChilkatCrypt2 进行加密。现在在 .NET 中,我想使用 System.Security.Cryptography。
我用了:
Public Function Encripta(pTexto As String, pChave As String, pModo As Byte) As String
Dim vMD5 As New ChilkatCrypt2
vMD5.UnlockComponent "..................."
vMD5.Charset = "utf-8"
vMD5.KeyLength = 128
vMD5.CryptAlgorithm = "rijndael"
vMD5.SecretKey = vMD5.GenerateSecretKey(pChave)
vMD5.EncodingMode = "hex"
If pModo = 1 Then
Encripta = vMD5.EncryptStringENC(pTexto)
Else
Encripta = vMD5.DecryptStringENC(pTexto)
End If
Set vMD5 = Nothing
End Function
谁能帮我在.NET(VB或C#)中重写它,以便现有的加密值正确解密。我无法弄清楚参数等效性。