Using Plain Text as Key and IV in mcrypt PHP

I have an application that exchanges data between vendor’s application in a TripleDES Encrytion using CBC method upon an agreed key and IV. My application is a VB.NET application while the vendor’s application is a PHP web page. The strange thing is that I cannot seem to match the output of the vendor’s application.

The key and initial vector are given to both of us in plaintext. The funny thing is, in the vendor’s application, they don’t hash or convert the key and IV to a 256 bit key and 128 bit IV. They just use the plaintext format in their code using mcrypt plugin in PHP.

$key = 'plaintextkey';
$iv = 'plaintextIV'
$enc = mcrypt_encrypt(MCRYPT_3DES, $key, $string, MCRYPT_MODE_CBC, $iv)

And it resulted in a funny text such as:

û!‰+«°z0″üÐÑn

My questions are:

  1. should a plaintext be used as a parameter, how does PHP
    implement/convert it into a 256 bit character?
  2. if CBC method is used, shouldn’t it depend on the previously
    encrypted text?
  3. is there a TripleDES result in my given format? Because as I
    searched through the internet and never have I seen a resulted
    encryption in such form.

I am really really new to encryption so I am very confused. If you can also provide me an article or video on encryption for total newbs I would really really appreciate it.

Thank you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s