Hi All

I have a question about decrypting with PHP and hope someone can help.

I have Visual Basic 6 application which creates encrypted strings:

Key Length: 128 bits
Encryption Algorithm: 3DES
String: THIS IS ENCRYPTED
Password: MY PASSWORD

Base64 Encrypted String:

MHIGCSsGAQQBgjdYA6BlMGMGCisGAQQBgjdYAw
GgVTBTAgMCAAECAmYDAgIAwAQIMIs5tY9YE3ME
EMKkmeQm0EazyicZ9zqBCvkEKHpyUxDDmgHrljY
Bz57c5PQST/5+AWOeqxJcqrr5ZUMnRPwdZhrCQ1w=

The code can be downloaded from:

http://www.wesayhowhigh.com/customer/vbproblem/vbencryptdata.zip

I am trying to decrypt the string with PHP and just cannot seem to decrypt the string.

I have tried all sorts of decryption with mcrypt and I am obviously missing something here.

Can anyone help me please?

Many thanks in advance

BB

    What is the encryption mode used? What is the initialisation vector?

    I have tried all sorts of decryption with mcrypt and I am obviously missing something here.

    What did you try?

    Incidentally, I do not think 128 bits is a correct key size for Triple DES. What is this for, anyway?

      Thanks for the response laserlight.

      To be honest I am confused about the whole encryption subject.

      I have a windows based application which delivers a test on-screen to a person. The test data file is downloaded via our PHP website. The application is working sweet as a nut until we switch on the encryption.

      The test data file needs to be encrypted and then decrypted by our VB application. I have spent days searching the internet for code both for VB and PHP (obviously not a very good combination as I cannot find anything).

      I am using the CAPICOM.dll from Microsoft which supports AES, 3DES, RC2 and RC4 but I cannot get an encrypted string which originates from PHP to decrypt via our VB application and vice-versa. Arrggh!!!!!

      CAPICOM supports the following:

      Dim encryptdata As New EncryptedData
      encryptdata.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_3DES
      encryptdata.Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM
      encryptdata.SetSecret ('my password')

      encryptdata.Content = 'My secret message'

      ' Return message as base64

      print encryptdata.Encrypt(CAPICOM_ENCODE_BASE64)

      Ideally I need help with both ends.

      I hope someone can help me further.

      Thanks in advance.

      BB

        Why not just use PGP (or gpg)? You could hook a system() call from PHP to a server-side installation of PGP, encrypt a text file, have php read it and echo it out as a download. You call that URL with your VB script, then use VB and PGP on the local system to decrypt it. There may even be a module for VB that does this, I have no idea.

          Write a Reply...