Author: jfthomps
Date: Thu May 10 19:14:14 2012
New Revision: 1336835

URL: http://svn.apache.org/viewvc?rev=1336835&view=rev
Log:
VCL-576
Finalizing for 2.3 release

testsetup.php: changed testing of mcrypt functions to use phpseclib's functions

Modified:
    incubator/vcl/trunk/web/testsetup.php

Modified: incubator/vcl/trunk/web/testsetup.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/testsetup.php?rev=1336835&r1=1336834&r2=1336835&view=diff
==============================================================================
--- incubator/vcl/trunk/web/testsetup.php (original)
+++ incubator/vcl/trunk/web/testsetup.php Thu May 10 19:14:14 2012
@@ -344,30 +344,27 @@ if($includesecrets && include('.ht-inc/s
 }
 
 # test mcrypt
-title("Testing mcrypt");
+title("Testing phpseclib");
+require_once(".ht-inc/phpseclib/Crypt/AES.php");
 print "<ul>\n";
-if(in_array('mcrypt', $exts)) {
-       if($includesecrets && ! empty($mcryptkey) && ! empty($mcryptiv) && 
strlen($mcryptiv) == 8) {
-               $teststring = 'testing';
-               if($cryptdata = mcrypt_encrypt(MCRYPT_BLOWFISH, $mcryptkey, 
$teststring, MCRYPT_MODE_CBC, $mcryptiv)) {
-                       pass("Successfully encrypted test string");
-                       $decrypted = mcrypt_decrypt(MCRYPT_BLOWFISH, 
$mcryptkey, $cryptdata, MCRYPT_MODE_CBC, $mcryptiv);
-                       if(trim($decrypted) == $teststring)
-                               pass("Successfully decrypted test string");
-                       else
-                               fail("Failed to decrypt test string");
-               }
-               else {
-                       fail("Failed to encrypt data with mcrypt");
-               }
+if($includesecrets && ! empty($cryptkey)) {
+       $teststring = 'testing';
+       $aes = new Crypt_AES();
+       $aes->setKey($cryptkey);
+       if($cryptdata = $aes->encrypt($teststring)) {
+               pass("Successfully encrypted test string");
+               $decrypted = $aes->decrypt($cryptdata);
+               if(trim($decrypted) == $teststring)
+                       pass("Successfully decrypted test string");
+               else
+                       fail("Failed to decrypt test string");
+       }
+       else {
+               fail("Failed to encrypt data with phpseclib");
        }
-       elseif($includesecrets && strlen($mcryptiv) != 8)
-               fail("Cannot test encryption when \$mcryptiv is not exactly 8 
characters");
-       else
-               fail("Cannot test encryption without \$mcryptkey and \$mcryptiv 
from .ht-inc/secrets.php");
 }
 else
-       fail("mcrypt extension missing");
+       fail("Cannot test encryption without \$cryptkey from 
.ht-inc/secrets.php");
 print "</ul>\n";
 
 # encryption keys


Reply via email to