'This class is responsible for decripting valuable data 'Call this method with parameters your data and key "NAPENCPT"
Public Class Encryption
'Decrypts data
Public Shared Function Decrypt(ByVal text As String, ByVal key As String) As String
Dim ms As MemoryStream = New MemoryStream
Try Dim encodedkey() As Byte Dim iv() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}
Dim bytes() As Byte
encodedkey = Encoding.UTF8.GetBytes(key)
Dim csp As DESCryptoServiceProvider = New DESCryptoServiceProvider
bytes = Convert.FromBase64String(text)
Dim cs As CryptoStream = New CryptoStream(ms, csp.CreateDecryptor(encodedkey, iv), CryptoStreamMode.Write)
cs.Write(bytes, 0, bytes.Length) cs.FlushFinalBlock()
Catch ex As Exception Return String.Empty End Try
Return Encoding.UTF8.GetString(ms.ToArray)
End Function
End Class
|
No responses found. Be the first to respond and make money from revenue sharing program.
|