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

Commit

Permalink
[ZF2-71] CS cleanup
Browse files Browse the repository at this point in the history
- Throw early
- Ensure comparison is sane by casting to upper
  • Loading branch information
weierophinney committed Oct 10, 2011
1 parent d6df3a8 commit b528911
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Rsa.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,14 @@ public function setCertificatePath($value)
*/
public function setHashAlgorithm($name)
{
switch (strtolower($name)) {
switch (strtolower($name)) {
case 'md2':
// check if md2 digest is enabled on openssl just for backwards compatibility
$digests = openssl_get_md_methods();
if (in_array($name, $digests)) {
$this->_hashAlgorithm = OPENSSL_ALGO_MD2;
} else {
if (!in_array(strtoupper($name), $digests)) {
throw new Zend\Crypt\Exception('Openssl md2 digest is not enabled (deprecated)');
}
$this->_hashAlgorithm = OPENSSL_ALGO_MD2;
break;
case 'md4':
$this->_hashAlgorithm = OPENSSL_ALGO_MD4;
Expand Down

0 comments on commit b528911

Please sign in to comment.