Decrypt کردن تصاویر در VB.Net
#1
Note 
تا حالا کد های زیادی برای Dectypt کردن دیتابیس ها و متن ها اومده اما کد Decrypt کردن تصاویر خیلی کم پیدا میشه که ما براتون میذاریم.

کد:
[VB]Imports System.IO
Imports System.Text
Imports System.Security.Cryptography
Imports System.Data.Odbc
Imports System.Drawing
Imports COZErrorLogging
Imports COZSQLException
Public Class Decryption
Public Function DecryptImage() As String
Try
Dim con As OdbcConnection = New OdbcConnection(_
"Dsn=mydbdsn;uid=icmadmin;pwd=password;alias=MYDBDATA;")
con.Open()
Dim cmd As OdbcCommand = New OdbcCommand(_
"select SIGNATURE from DSCSIGNATURE_MASTER", con)
Dim dr As OdbcDataReader = cmd.ExecuteReader()
Dim key As New DESCryptoServiceProvider()
Dim keybytes() As Byte = ASCIIEncoding.ASCII.GetBytes("abcdEFGH")
key.Key = keybytes
dr.Read()
Dim rawData() As Byte
Dim sizeS As String
sizeS = dr.GetString(0)
rawData = Convert.FromBase64String(sizeS)
Dim des As New DESCryptoServiceProvider()
des.Mode = CipherMode.ECB
des.Padding = PaddingMode.None
des.Key() = UTF8Encoding.UTF8.GetBytes("abcdEFGH")
Dim desdecrypt As ICryptoTransform = des.CreateDecryptor(des.Key(), des.IV)
Dim memoryStream As MemoryStream = New MemoryStream(rawData)
Dim cryptostreamDecr As New CryptoStream(_
memoryStream, desdecrypt, CryptoStreamMode.Write)
cryptostreamDecr.Write(rawData, 0, rawData.Length)
Dim retrunImage As Image = Image.FromStream(memoryStream)
retrunImage.Save("C:\\Sudhakar.jpg")
cryptostreamDecr.Close()
Return "C:\\Sudhakar.jpg"
Catch ex As Exception
MessageBox.Show("Error Occured")
Return ex.Message
End Try
End Function
Public Shared Sub main()
Dim obj As New Decryption
Console.WriteLine("Testing")
Dim DecryptedSignaturePath As String = obj.DecryptImage()
Console.WriteLine("Testing Completed")
End Sub
End Class[/VB]

[VB]Dim obj As New Decryption

Console.WriteLine("Testing")

Dim DecryptedSignaturePath As String = obj.DecryptImage()

Console.WriteLine("Testing Completed")[/VB]

مثلا این رشته یک عکس encrypt شدس که از دیتابیس گرفته شده:

[HTML]
Aco5uskB95t+3JeNiJSjTNzdDpGH33M9dOx68XhaWPmU5jHvNKmBLK/wDUmBSHFU5hjbxWGqqRmu

DRs8uuwQCVxPxSqFRJBixdxTuDYx+ZhMUrccGeAa3ZV3vBFw4+hhfIGq4sHVxxd1+rZ30JpslPA9

knGDp0sH8D2ScYOnSwfwPZJxg6dLB/A9knGDp0sH8D2ScYOnSwfeAdHMoABGTfy4KqYjWI1bdqGg

ff7OX+vnQUjALz12Yw8NcvFkhwZ3KbvrY7HeJeOlbQfy1GgRguoKLfQHpwNNXYQ03VGd+TNvpz2K

G5W+a2EINIKLJa9GaREA57aSlZ9MO1BzlbdhyJ1xQ6hU/nnZT2aOqV8pXM23EkiEvCx08rDMyH8V

UMbhF61N5FPhiB+9FstMxnljjvFCN+BwPhRypngb0m4C0kbLV13ibdY7wqQnjL6IaWHo212ZHiCU

BwqSnI8ioLnyOBm07jzAhjUeT2V5pAM5VtlwbPJ2t5z4BDDM1LE9WsyzC+S1JzZHK/mzX9sjM96K

ZnyHjZGltQs8Oa1uFYJ8jfqlbQfy1GgRgtfVvoV8vP46lP6tBemZWF8l5a/5BorCUsSW6Fpop8YI

3ipNtvNEbGJTco7doKRQuP6/jvYvDFh14mVmP8sGYrVaoPpqyqQEbKZVQJOVUDKVcLr8NHQjTUzq

JqyjETMi/AOxCwS3zsVVMBrxCI4zCDjURTHW14Cv9VkZx5m3RIfr4CfXf8Z3xkqlyvPBq+3aaqLt

lHKLBlyZe5vym54RiiYO/Kq3JQ+XPZFKVAic80PCC+S1JzZHK/l85b3WDIKwcx9Q434nl0NpH5Th

+0eeHWs0lkOFXuxSrTSWQ4Ve7FKtNJZDhV7sUq00lkOFXuxSrTSWQ4Ve7FKtNJZDhV7sUq00lkOF

XuxSrTSWQ4Ve7FKtNJZDhV7sUq00lkOFXuxSrTSWQ4Ve7FKtNJZDhV7sUq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zaprWuNLk

kvNqmta40uSS82qa1rjS5JLzaprWuNLkkvNqmta40uSS82qa1rjS5JLzaprWuNLkkvNqmta40uSS

82qa1r6fMsy5BuOm
[/HTML]

خروجی که کد به ما میده:

[تصویر:  Sudhakar.jpg]


MeeGo.

پاسخ
ایجاد موضوع جدید   پاسخ به موضوع  

کاربرانِ درحال بازدید از این موضوع:   1 مهمان