PC Review


Reply
Thread Tools Rate Thread

calling cryptography experts!

 
 
andy
Guest
Posts: n/a
 
      12th Mar 2006
Hi all

Am trying to encrypt an xml file in php then decrypt using vb.net.

We use 3des on php to encrypt , in this case the encrypted string is :
"nM+uUETBa2NY2jfUtmv5lJtiyBp2b8Wvv4lWqtr82Wpv9+fCugOGIgDBjlKhQXkeMJEYvdBMkZBh9FSQyVizTWxUzmWE5VBrWQdYniupC6jwxp46+b5/D5LyJM08I7KXCshL0Y1Mw9EX1bW8642qV/KmWqeg3viYHs9MsHxPrCLMl6k/dzGyGZop5OL3M3ApsvV8ftJjHwLTU4Yq9QROwr45qkTG45Uq+JbgFdLuz4qgnd2DFi3QZJsG4ZwBewSljnVGRsse2wBQxyJuwVskckeFjob2P715hIrAQCzUf7c="

The key is "andy"

then i use the below vb.net function to decrypt..
The function fails with a message "Bad Data", any ideas on how to tune
it up to decrypt this?


Public Function Decrypting(ByVal [Source] As String, ByVal Key As
String) As String
' convert from Base64 to binary
Dim bytIn As Byte() =
System.Convert.FromBase64String([Source])
' create a MemoryStream with the input
Dim ms As New System.IO.MemoryStream(bytIn, 0,
bytIn.Length)

Dim bytKey As Byte() = GetLegalKey(Key)

' set the private key
mobjCryptoService.Key = bytKey
mobjCryptoService.IV = bytKey

' create a Decryptor from the Provider Service instance
Dim encrypto As ICryptoTransform =
mobjCryptoService.CreateDecryptor()

' create Crypto Stream that transforms a stream using the
decryption
Dim cs As New CryptoStream(ms, encrypto,
CryptoStreamMode.Read)

' read out the result from the Crypto Stream
Dim sr As New System.IO.StreamReader(cs)
Return sr.ReadToEnd()
End Function 'Decrypting

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Security.Cryptography and OpenNETCF.Security.Cryptography Jeffry van de Vuurst Microsoft Dot NET Compact Framework 3 13th Dec 2006 03:46 PM
Can't install SP1 on XP Home - Cryptography error Derek Schaffner Windows XP Help 1 22nd Jun 2004 03:09 AM
Cryptography prob solved anar Windows XP Security 0 14th Aug 2003 07:00 PM
Cryptography prob anar Windows XP Security 0 14th Aug 2003 06:33 PM
Re: Cryptography prob Lanwench [MVP - Exchange] Windows XP Security 0 14th Aug 2003 06:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:11 PM.