在vb.net和2.0 Framework中开发了一个旧的Web应用程序。应用程序读取存储在Windows注册表中的sql server name的加密信息。说到这行代码
ConnectionStr = Encoding.ASCII.GetString(plainText)
我在字符串
中收到问号“P 25 ARSMEYVDE02”
它应该是
“PLWARSMEYVDE02”
我尝试将编码更改为UTF8,默认或Unicode,但没有运气。这是函数
Public Function HostLogOnParameters() As Boolean
Try
Dim rk As RegistryKey = Registry.LocalMachine.OpenSubKey(ConfigurationSettings.AppSettings("Registry.LocalMachine") & "Host", False)
Dim ConnectionStr As String = rk.GetValue("1")
Dim initVector As String = rk.GetValue("2")
Dim strKey As String = rk.GetValue("3")
Dim dec As New Decryptor
dec.Decryptor(EncryptTransformer.EncryptionAlgorithm.TripleDes)
dec.IV = Convert.FromBase64String(initVector)
'Decrypt the string
Dim plainText As Byte() = dec.Decrypt(Convert.FromBase64String(ConnectionStr), Convert.FromBase64String(strKey))
ConnectionStr = Encoding.ASCII.GetString(plainText)
ConnectionStr = ConnectionStr.Substring(1)
mstrServer = Left(ConnectionStr, InStr(ConnectionStr, "'") - 1)
ConnectionStr = ConnectionStr.Substring(mstrServer.Length + 3)
mstrDatabase = Left(ConnectionStr, InStr(ConnectionStr, "'") - 1)
ConnectionStr = ConnectionStr.Substring(mstrDatabase.Length + 3)
mstrUser = Left(ConnectionStr, InStr(ConnectionStr, "'") - 1)
ConnectionStr = ConnectionStr.Substring(mstrUser.Length + 3)
mstrPassvord = Left(ConnectionStr, InStr(ConnectionStr, "'") - 1)
Return True
Catch ex As Exception
Return False
End Try
End Function
plainText的输出为十六进制。
2750CCD74152534D45595644455630325C44455656533032272C2745594372797374616C486F73744244272C274372797374616C486F737455736572272C273132337265706F7274696E6721402327
答案 0 :(得分:0)
它可能是拉丁语(ISO 8859-1),因为它读取PÌ×ARSMEYVDEV02\DEVVS02
,而Pixar当然是一个知名公司。请注意,Windows-1252是此字符编码的超集。