我試圖解密我的密碼存儲在aspnet_membership
表...解密ASPNET_Membership密碼
我使用下面的代碼,
Dim encodedPassword() As Byte = System.Text.Encoding.UTF8.GetBytes(password)
encodedPassword = MyBase.EncryptPassword(encodedPassword)
Dim decryptedPassword() As Byte = MyBase.DecryptPassword(encodedPassword)
If (decryptedPassword IsNot Nothing) Then
Return System.Text.Encoding.UTF8.GetString(decryptedPassword, 0, decryptedPassword.Length)
End If
但在DecryptPassword(encodedPassword)
行它顯示誤差
「要解密的數據長度無效。」
如果密碼由內置的MembershipProvider加密,則無法解密密碼。 – Eranga 2012-01-11 13:37:56
@Eranga - 對於默認提供程序,它取決於passwordFormat設置。默認情況下它是「散列」,但可以設置爲「加密」。 – PHeiberg 2012-01-11 14:20:19
@PHeiberg你是對的。忘記了'passwordFormat'選項。 – Eranga 2012-01-11 14:32:57