C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Encryption »

Decryption of string in VB.Net


Posted Date: 10 Sep 2008    Resource Type: Code Snippets    Category: Encryption
Author: Shivashankar ChincholiMember Level: Gold    
Rating: 1 out of 5Points: 8




'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



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Decryption  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Password Encryption And Decryption
Previous Resource: Decryption of string in C#
Return to Discussion Resource Index
Post New Resource
Category: Encryption


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use