GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Nov-2004, 03:24
optik_knight optik_knight is offline
New Member
 
Join Date: Nov 2004
Location: Moscow ID or Yakima WA
Posts: 6
optik_knight is on a distinguished road

Need help with Mcrypt installation


Hey ya'll,

I'm new on GIDForums. Figured this would be a good place to start when looking for people of relevant skills to answer my questions...

Today, I've discovered that my life would be a lot easier if I used the php_mcrypt extension, rather than my own code. So I've been trying to install it, and I think I've got everything working (after 2 hours of searching for the right dll files)... except one minor detail...
Notice: Use of undefined constant MCRYPT_TWOFISH256 - assumed 'MCRYPT_TWOFISH256' in D:\Web\enc\encryption\encryption.inc on line 19

Warning: mcrypt_encrypt(): Module initialization failed in D:\Web\enc\encryption\encryption.inc on line 19
Encrypted:
I've got php_mcrypt.dll in my c:\php\ folder (with all my other extensions), it's activated in php.ini (uncommented), and I've got libmcrypt.dll in my c:\windows\system32\ folder. It just can't seem to find the modules for the encryption algorithms. I'm not sure where to put them, how to register them, or whatever I need to do.

All help would be much appreciated!


Thanks!
  #2  
Old 27-Nov-2004, 11:58
optik_knight optik_knight is offline
New Member
 
Join Date: Nov 2004
Location: Moscow ID or Yakima WA
Posts: 6
optik_knight is on a distinguished road
Note: Please ignore the line "Encrypted: " ... it's from the content that follows.

The call that's causing this error:
$cipher = mcrypt_encrypt(MCRYPT_TWOFISH256,md5($private_key) ,$data,MCRYPT_MODE_CBC);

From various alterations to the code, and still getting the same result, I gather that the library isn't loading right.
  #3  
Old 27-Nov-2004, 12:58
optik_knight optik_knight is offline
New Member
 
Join Date: Nov 2004
Location: Moscow ID or Yakima WA
Posts: 6
optik_knight is on a distinguished road

Major Code Revision


I've changed the code again...
Here's the code:

PHP Code:

$mc_module = mcrypt_module_open(MCRYPT_TWOFISH256,'',MCRYPT_MODE_CBC,'');
    if($mc_module){
        mcrypt_generic_init($mc_module,$private_key,$iv);
        $output = mcrypt_generic($mc_module,$output);
        mcrypt_generic_deinit($mc_module);
        mcrypt_module_close($mc_module);
    }else{
        echo "An error has occurred in your mcrypt_module_open call. Cannot continue.";
        echo "Normally this is caused due to the inability to load the encryption algorithms";
        exit();
    } 


And here's the error I'm getting:

Warning: mcrypt_module_open(): Could not open encryption module in /home/httpd/vhosts/dev.cabinriver.net/subdomains/mts/httpdocs/sam/encrypt/encryption.inc on line 20

I think it has to do with my mcrypt_module_open(<algorithm>,<path to algorithm>...) call... I don't know where the algorithms are stored. Any tips? (And yes, ya'll can sarcastically tell me that I need to put a path in there instead of '')

Thanks
Last edited by JdS : 28-Nov-2004 at 03:20. Reason: Code formatting
  #4  
Old 28-Nov-2004, 03:04
optik_knight optik_knight is offline
New Member
 
Join Date: Nov 2004
Location: Moscow ID or Yakima WA
Posts: 6
optik_knight is on a distinguished road

Next Issue...


OK, so I'm not getting that error anymore. I've made significant changes to my code. But now I'm getting other weird behavior... it seems that when I use mcrypt_generic() with the appropriate data, I get a perfectly good looking cipher text, but I can't seem to decrypt it (using mdecrypt_generic()). Not sure what the problem is, but from looking around, I may not be the first person to see this one. If someone would be willing to look at my code in depth, it would be much appreciated, but the quantity of code that I've got isn't practical to post here.

Please let me know if you're willing to do so. Thanks!
(email: optik@myrealbox.com)
Last edited by JdS : 28-Nov-2004 at 03:21. Reason: please do NOT feed the spambots with email addresses in your posts
  #5  
Old 28-Nov-2004, 03:18
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello optik_knight,

I had some success using the mcrypt functions in some of my scripts. That doesn't mean I know enough to troubleshoot your problem. I however, do recall not being able to use every mcrypt cipher as listed in the php manual.

I am just guessing that this is win32 specific issue, where only some of these ciphers work and the rest remain unsupported. Could that be it?
  #6  
Old 28-Nov-2004, 03:23
optik_knight optik_knight is offline
New Member
 
Join Date: Nov 2004
Location: Moscow ID or Yakima WA
Posts: 6
optik_knight is on a distinguished road
Quote:
Originally Posted by JdS
I am just guessing that this is win32 specific issue, where only some of these ciphers work and the rest remain unsupported. Could that be it?

Yeah, sounds reasonable. I've tried several and haven't had any luck on my win32 system. I ran the scripts on a *nix development server and it worked... once... and then it didn't work again after that. So I'm not really sure what the problem is. I'm rather confused.

Any chance that recent distributions of the mcrypt libraries are bugged/unreliable?
  #7  
Old 28-Nov-2004, 03:26
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
My experience with the mcrypt functions are that only a few of these ciphers never worked for me in my scripts, the rest however did work beautifully.

I use it to create encrypted urls (off the list of hosts) in the "GIDWebHosts" site in my signature.
  #8  
Old 28-Nov-2004, 03:39
optik_knight optik_knight is offline
New Member
 
Join Date: Nov 2004
Location: Moscow ID or Yakima WA
Posts: 6
optik_knight is on a distinguished road
Interesting. I'll be using them to encrypt files to be stored in a MySQL database for a secure online storage site. ... but not until I get this working, of course. In the mean time, I've found a way to manipulate the data in a way that it's decryptable, just not using the normal encryption functions. The result, unfortunately it's roughtly 3x the size of the original file... too much bloat for me, so I'm trying to use the mcrypt library as an alternative.

Do you happen to know anyone who's particularly experienced with mcrypt and its various applications?
  #9  
Old 28-Nov-2004, 03:47
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Maybe if you can post just the portions of your code where you are using the mcrypt functions, I can quickly take a look at it for you.

Please do not post your entire script here...
 

Recent GIDBlogThe bogus security of airport screening by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Installation Jags Computer Software Forum - Linux 1 26-May-2004 16:37
Apache installation problems kenmbobua Apache Web Server Forum 1 12-May-2004 11:31
Apache 2 Installation Issues yudansha nic Apache Web Server Forum 3 26-Feb-2004 03:52
qmail installation problem dharm_shankar Computer Software Forum - Linux 3 06-Feb-2004 04:15
problem with php5 cgi installation fab13 Apache Web Server Forum 3 19-Nov-2003 09:11

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:37.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.