Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Rextester.Program.Main is the entry point for your code. Don't change it.
  2. 'Compiler version 11.0.50709.17929 for Microsoft (R) .NET Framework 4.5
  3.  
  4. Imports System
  5. Imports System.Collections.Generic
  6. Imports System.Linq
  7. Imports System.Text.RegularExpressions
  8. Imports System.Text
  9. Imports System.Security.Cryptography
  10.  
  11. Namespace Rextester
  12.     Public Module Program
  13.         Public Sub Main(args() As string)
  14.             Dim initVectorBytes As Byte()
  15.             initVectorBytes = Encoding.ASCII.GetBytes("464R5DFA5DL6LE28")
  16.            
  17.             Dim saltValueBytes As Byte()
  18.             saltValueBytes = Encoding.ASCII.GetBytes("88552299")
  19.            
  20.             Dim cipherTextBytes As Byte()
  21.             cipherTextBytes = Convert.FromBase64String("fTEzAfYDoz1YzkqhQkH6GQFYKp1XY5hm7bjOP86yYxE=")
  22.            
  23.             Dim password As New Rfc2898DeriveBytes("fTEzAfYDoz1YzkqhQkH6GQFYKp1XY5hm7bjOP86yYxE=", System.Text.Encoding.ASCII.GetBytes("88552299"), 2)
  24.            
  25.             Dim keyBytes As Byte()
  26.             keyBytes = password.GetBytes(CInt(256 / 8))
  27.  
  28.             Dim symmetricKey As New AesCryptoServiceProvider
  29.             symmetricKey.Mode = CipherMode.CBC
  30.  
  31.             Dim decryptor As ICryptoTransform
  32.             decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes)
  33.  
  34.             Dim memoryStream As IO.MemoryStream
  35.             memoryStream = New IO.MemoryStream(cipherTextBytes)
  36.             memoryStream = New IO.MemoryStream(cipherTextBytes)
  37.  
  38.             Dim cryptoStream As CryptoStream
  39.             cryptoStream = New CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read)
  40.  
  41.             Dim plainTextBytes As Byte()
  42.             ReDim plainTextBytes(cipherTextBytes.Length)
  43.  
  44.             Dim decryptedByteCount As Integer
  45.             'decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length)
  46.            decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, 33)
  47.  
  48.             memoryStream.Close()
  49.             cryptoStream.Close()
  50.  
  51.             Dim plainText As String
  52.             plainText = Encoding.ASCII.GetString(plainTextBytes, 0, decryptedByteCount)
  53.  
  54.             Console.WriteLine(plainTextBytes.Length)
  55.         End Sub
  56.     End Module
  57. End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement