Aescrypt code not executing in my linux server

Discussion related to AES Crypt, the file encryption software for Windows, Linux, Mac, and Java.
Post Reply
pradeepkondapaka
Posts: 3
Joined: Fri Feb 20, 2015 5:20 am

Aescrypt code not executing in my linux server

Post by pradeepkondapaka »

Hi Guys,

I have tested the aescode in my local wamp server,its working fine, while i am testing in my server the code

Code: Select all

"$openMode = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');"
is not executed, i have installed aescrypt in my server also, but no use. please any one give me a solution for this
User avatar
paulej
Posts: 593
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Aescrypt code not executing in my linux server

Post by paulej »

It looks like you're trying to use PHP. There are two PHP implementations of AES Crypt written by different authors. I'm not familiar with either, but the links are on the download page.

Are you trying to use either of those or something else?
pradeepkondapaka
Posts: 3
Joined: Fri Feb 20, 2015 5:20 am

Re: Aescrypt code not executing in my linux server

Post by pradeepkondapaka »

Yes, Here i am using Php, here i want to test my ccavenue, but this php encryption file doesn't run any more.

Code: Select all

function encrypt($plainText,$key)
	{
        echo "1q";
		$secretKey = hextobin(md5($key));
  echo "2";
		$initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
  echo "3";
	  		  	$openMode = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');

  echo "4";
	  	$blockSize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc');
  echo "5";
		$plainPad = pkcs5_pad($plainText, $blockSize);
  echo "6";
	  	if (mcrypt_generic_init($openMode, $secretKey, $initVector) != -1) 
		{
		      $encryptedText = mcrypt_generic($openMode, $plainPad);
	      	      mcrypt_generic_deinit($openMode);
		      			
		} 

		return bin2hex($encryptedText);
	}

here i am unable to display echo "4"
User avatar
paulej
Posts: 593
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Aescrypt code not executing in my linux server

Post by paulej »

What AES Crypt code are you using? I'm not familiar with the php implementations, but there are at least two available from aescrypt.com.
pradeepkondapaka
Posts: 3
Joined: Fri Feb 20, 2015 5:20 am

Re: Aescrypt code not executing in my linux server

Post by pradeepkondapaka »

Here i am not using the default php crypt functions, the CCAvenue team follows one cryptography, they gave us that file along with test integration kit (crypto.php file). here i am sending the code, please review it and give me some suggetions.

Code: Select all

<?php

	error_reporting(0);

	function encrypt($plainText,$key)
	{
		$secretKey = hextobin(md5($key));
		$initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
	  	$openMode = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');
	  	$blockSize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc');
		$plainPad = pkcs5_pad($plainText, $blockSize);
	  	if (mcrypt_generic_init($openMode, $secretKey, $initVector) != -1) 
		{
		      $encryptedText = mcrypt_generic($openMode, $plainPad);
	      	      mcrypt_generic_deinit($openMode);
		      			
		} 
		return bin2hex($encryptedText);
	}

	function decrypt($encryptedText,$key)
	{
		$secretKey = hextobin(md5($key));
		$initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
		$encryptedText=hextobin($encryptedText);
	  	$openMode = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '','cbc', '');
		mcrypt_generic_init($openMode, $secretKey, $initVector);
		$decryptedText = mdecrypt_generic($openMode, $encryptedText);
		$decryptedText = rtrim($decryptedText, "\0");
	 	mcrypt_generic_deinit($openMode);
		return $decryptedText;
		
	}
	//*********** Padding Function *********************

	 function pkcs5_pad ($plainText, $blockSize)
	{
	    $pad = $blockSize - (strlen($plainText) % $blockSize);
	    return $plainText . str_repeat(chr($pad), $pad);
	}

	//********** Hexadecimal to Binary function for php 4.0 version ********

	function hextobin($hexString) 
   	 { 
        	$length = strlen($hexString); 
        	$binString="";   
        	$count=0; 
        	while($count<$length) 
        	{       
        	    $subString =substr($hexString,$count,2);           
        	    $packedString = pack("H*",$subString); 
        	    if ($count==0)
		    {
				$binString=$packedString;
		    } 
        	    
		    else 
		    {
				$binString.=$packedString;
		    } 
        	    
		    $count+=2; 
        	} 
  	        return $binString; 
    	  } 
?>

User avatar
paulej
Posts: 593
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Aescrypt code not executing in my linux server

Post by paulej »

That code isn't AES Crypt code. It appears to be trying to use the AES algorithm, but AES Crypt isn't just using the AES algorithm.

In AES Crypt, there are a set of procedures for turning a password into a key using SHA256, formatting the output file, protection using HMAC-SHA256, etc. I don't see any of that in this code. In fact, I see use of MD5, which AES Crypt doesn't use.
Post Reply