Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using System.Security.Cryptography
Message
From
16/11/2003 13:53:50
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Using System.Security.Cryptography
Miscellaneous
Thread ID:
00850467
Message ID:
00850467
Views:
52
I am using System.Security.Cryptography to encrypt and decrypt some big XML files. I am able to encrypt using a custom key. However, the code I am using can only support up to 8 characters for the key. The client requested to have 32 characters. Is that doable? If yes, would that mean I'd have it slower whenever we will process the encryption methods?

The code I am using is this:
   ' The function used to encrypt the text
   Public Shared Function Encrypt(ByVal tcString As String, ByVal tcKey As String) As String

      Dim byKey() As Byte = {}

      Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}

      Try

         byKey = System.Text.Encoding.UTF8.GetBytes(Mid(tcKey, 1, 8))

         Dim des As New DESCryptoServiceProvider

         Dim inputByteArray() As Byte = Encoding.UTF8.GetBytes(tcString)

         Dim ms As New MemoryStream

         Dim cs As New CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write)

         cs.Write(inputByteArray, 0, inputByteArray.Length)

         cs.FlushFinalBlock()

         Return Convert.ToBase64String(ms.ToArray())

      Catch ex As Exception

         Return ex.Message

      End Try

   End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform