Re: [Bcrypt-users] Bcrypt and PHP
Status: Beta
Brought to you by:
jwshelley
From: Brett S. <Bre...@gr...> - 2008-10-31 11:29:01
|
Hi Johnny, I thought I'd update you with progress in automating Bcrypt for PHP. I performed the following: 1. Installed Cygwin Unix Tools http://www.cygwin.com/ - PHP is running on a Windows server 2. On installation, specified 'bcrypt', 'cron' and 'expect' packages to be included 3. Created a shell script: #!/bin/bash # $filename - filename to encrypt # $password - password to use # ..... VAR=$(expect -c " spawn bcrypt -r $filename expect \"Encryption key:\" send \"$password\r\" expect \"Again:\" send \"$password\r\" ") echo "$VAR" # ..... 4. The PHP application runs independently of the Bcrypt shell script. PHP creates the file to be encrypted and places it in a secure directory on the Windows server (which is running PHP and Cygwin). Cygwin can access Windows filesystem (eg /cygdrive/c/windows) 5. A cronjob is setup to run at regular intervals to check to see if a file exists in the secure directory and then encrypts it using the Bcrypt shell script (above). It's not a beautiful solution but it has solved our problem ;) Regards Brett. |