Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/Key/Derivation/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Crypt
* @subpackage Exception
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Key/Derivation/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Crypt
* @subpackage Exception
*/
class RuntimeException extends Exception\RuntimeException implements
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
{}
4 changes: 2 additions & 2 deletions src/Key/Derivation/Pbkdf2.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public static function calc($hash, $password, $salt, $iterations, $length)
$result = '';
for ($block = 1; $block <= $num; $block++) {
$hmac = Hmac::compute($password, $hash, $salt . pack('N', $block), Hmac::OUTPUT_BINARY);
$mix = $hmac;
$mix = $hmac;
for ($i = 1; $i < $iterations; $i++) {
$hmac = Hmac::compute($password, $hash, $hmac, Hmac::OUTPUT_BINARY);
$mix ^= $hmac;
$mix ^= $hmac;
}
$result .= $mix;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Password/Bcrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct($options = array())
public function create($password)
{
if (empty($this->salt)) {
$salt = Math::randBytes(self::MIN_SALT_SIZE);
$salt = Math::randBytes(self::MIN_SALT_SIZE);
} else {
$salt = $this->salt;
}
Expand All @@ -85,7 +85,7 @@ public function create($password)
$prefix = '$2y$';
} else {
$prefix = '$2a$';
// check if the password contains 8-bit character
// check if the password contains 8-bit character
if (preg_match('/[\x80-\xFF]/', $password)) {
throw new Exception\RuntimeException(
'The bcrypt implementation used by PHP can contains a security flaw using password with 8-bit character. ' .
Expand Down
2 changes: 1 addition & 1 deletion src/Password/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Crypt
* @subpackage Exception
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Password/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Crypt
* @subpackage Exception
*/
class RuntimeException extends Exception\RuntimeException implements
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Symmetric/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Crypt
* @subpackage Exception
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Symmetric/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
* @package Zend_Crypt
* @subpackage Exception
*/
class RuntimeException extends Exception\RuntimeException implements
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
{}
10 changes: 5 additions & 5 deletions src/Symmetric/PaddingPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin manager implementation for the padding adapter instances.
*
* Enforces that padding adapters retrieved are instances of
* Padding\PaddingInterface. Additionally, it registers a number of default
* Padding\PaddingInterface. Additionally, it registers a number of default
* padding adapters available.
*
* @category Zend
Expand All @@ -27,7 +27,7 @@ class PaddingPluginManager extends AbstractPluginManager
{
/**
* Default set of padding adapters
*
*
* @var array
*/
protected $invokableClasses = array(
Expand All @@ -36,7 +36,7 @@ class PaddingPluginManager extends AbstractPluginManager

/**
* Do not share by default
*
*
* @var bool
*/
protected $shareByDefault = false;
Expand All @@ -45,8 +45,8 @@ class PaddingPluginManager extends AbstractPluginManager
* Validate the plugin
*
* Checks that the padding adaper loaded is an instance of Padding\PaddingInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\InvalidArgumentException if invalid
*/
Expand Down
10 changes: 5 additions & 5 deletions src/SymmetricPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin manager implementation for the symmetric adapter instances.
*
* Enforces that symmetric adapters retrieved are instances of
* Symmetric\SymmetricInterface. Additionally, it registers a number of default
* Symmetric\SymmetricInterface. Additionally, it registers a number of default
* symmetric adapters available.
*
* @category Zend
Expand All @@ -26,7 +26,7 @@ class SymmetricPluginManager extends AbstractPluginManager
{
/**
* Default set of symmetric adapters
*
*
* @var array
*/
protected $invokableClasses = array(
Expand All @@ -35,7 +35,7 @@ class SymmetricPluginManager extends AbstractPluginManager

/**
* Do not share by default
*
*
* @var bool
*/
protected $shareByDefault = false;
Expand All @@ -45,8 +45,8 @@ class SymmetricPluginManager extends AbstractPluginManager
*
* Checks that the adapter loaded is an instance
* of Symmetric\SymmetricInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\InvalidArgumentException if invalid
*/
Expand Down
4 changes: 2 additions & 2 deletions test/BlockCipherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*/
class BlockCipherTest extends \PHPUnit_Framework_TestCase
{
/**
* @var BlockCipher
/**
* @var BlockCipher
*/
protected $blockCipher;
protected $plaintext;
Expand Down
6 changes: 3 additions & 3 deletions test/Key/Derivation/Pbkdf2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public function testCalcWithWrongHash()

/**
* Test vectors from RFC 6070
*
* @see http://tools.ietf.org/html/draft-josefsson-pbkdf2-test-vectors-06
*
* @see http://tools.ietf.org/html/draft-josefsson-pbkdf2-test-vectors-06
*/
public static function provideTestVectors()
{
Expand All @@ -59,7 +59,7 @@ public static function provideTestVectors()
}

/**
* @dataProvider provideTestVectors
* @dataProvider provideTestVectors
*/
public function testRFC670($hash, $password, $salt, $cycles, $length, $expect)
{
Expand Down
6 changes: 3 additions & 3 deletions test/Password/BcryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function setUp()
} else {
$this->prefix = '$2a$';
}
$this->bcryptPassword = $this->prefix . '14$MTIzNDU2Nzg5MDEyMzQ1NeWUUefVlefsTbFhsbqKFv/vPSZBrSFVm';
$this->bcryptPassword = $this->prefix . '14$MTIzNDU2Nzg5MDEyMzQ1NeWUUefVlefsTbFhsbqKFv/vPSZBrSFVm';
}

public function testConstructByOptions()
Expand Down Expand Up @@ -121,12 +121,12 @@ public function testVerify()
$this->assertTrue($this->bcrypt->verify($this->password, $this->bcryptPassword));
$this->assertFalse($this->bcrypt->verify(substr($this->password, -1), $this->bcryptPassword));
}

public function testPasswordWith8bitCharacter()
{
$password = 'test' . chr(128);
$this->bcrypt->setSalt($this->salt);

if (version_compare(PHP_VERSION, '5.3.7') >= 0) {
$this->assertEquals('$2y$14$MTIzNDU2Nzg5MDEyMzQ1NexAbOIUHkG6Ra.TK9QxHOVUhDxOe4dkW', $this->bcrypt->create($password));
} else {
Expand Down
12 changes: 6 additions & 6 deletions test/PublicKey/DiffieHellmanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testWithSpec()
DiffieHellman::useOpensslExtension(false);
$alice = new DiffieHellman($aliceOptions['prime'], $aliceOptions['generator'], $aliceOptions['private']);
$bob = new DiffieHellman($bobOptions['prime'], $bobOptions['generator'], $bobOptions['private']);

$alice->generateKeys();
$bob->generateKeys();

Expand Down Expand Up @@ -81,10 +81,10 @@ public function testWithBinaryFormsAndLargeIntegers()
);

DiffieHellman::useOpensslExtension(false);

$alice = new DiffieHellman($aliceOptions['prime'], $aliceOptions['generator'], $aliceOptions['private']);
$bob = new DiffieHellman($bobOptions['prime'], $bobOptions['generator'], $bobOptions['private']);

$alice->generateKeys();
$bob->generateKeys();

Expand All @@ -103,7 +103,7 @@ public function testWithBinaryFormsAndLargeIntegers()

// both Alice and Bob should now have the same secret key
$expectedSharedSecret = base64_decode('FAAkw7NN1+raX9K1+dR3nqX2LZcDYYuZH13lpasaDIM4/ZXqbzdgiHZ86SILN27BjmJObtNQG/SNHfhxMalLMtLv+v0JFte/6+pIvMG9tAoPFsVh2BAvBuNpLY5W5gusgQ2p4pvJK0wz9YJ8iFdOHEOnhzYuN7LS/YXx2rBOz0Q=');

$this->assertEquals($expectedSharedSecret, $aliceSecretKey);
$this->assertEquals($expectedSharedSecret, $bobSecretKey);
}
Expand Down Expand Up @@ -132,10 +132,10 @@ public function testWithBinaryFormsAndLargeIntegersAndOpenssl()

$alice = new DiffieHellman($aliceOptions['prime'], $aliceOptions['generator'], $aliceOptions['private']);
$bob = new DiffieHellman($bobOptions['prime'], $bobOptions['generator'], $bobOptions['private']);

$alice->generateKeys();
$bob->generateKeys();

$this->assertEquals('0DmJUe9dr02pAtVoGyLHdC+rfBU3mDCelKGPXRDFHofx6mFfN2gcZCmp/ab4ezDXfpIBOatpVdbn2fTNUGo64DtKE2WGTsZCl90RgrGUv8XW/4WDPXeE7g5u7KWHBG/LCE5+XsilE5P5/GIyqr9gsiudTmk+H/hiYZl9Smar9k0=',
base64_encode($alice->getPublicKey(DiffieHellman::FORMAT_BINARY)));
$this->assertEquals('v8puCBaHdch0stxmkyS/sZvZHyB5f0AVkopAQ5wKSZIyEHHcGn7DXXH2u4WdCL+kMr8BcRpxRBJ0TDwfZPpu53nFNEjUd81WlfaKk95e4a/DC4dhlfBkQMebleobhedQPFAo7F9SkHN7uTLa/glxG+3T9DTb+ikcOVPoH3A1G6g=',
Expand Down
4 changes: 2 additions & 2 deletions test/PublicKey/RsaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RsaTest extends \PHPUnit_Framework_TestCase

/** @var Rsa */
protected $rsa;

/** @var Rsa */
protected $rsaBase64Out;

Expand Down Expand Up @@ -141,7 +141,7 @@ public function testFacrotyCreatesInstance()
));
$this->assertInstanceOf('Zend\Crypt\PublicKey\Rsa', $rsa);
$this->assertInstanceOf('Zend\Crypt\PublicKey\RsaOptions', $rsa->getOptions());
}
}

public function testFacrotyCreatesKeys()
{
Expand Down

0 comments on commit 4a7c17e

Please sign in to comment.