- $underlyingPassword = $this->factory->newFromCiphertext( openssl_decrypt(
- base64_decode( $this->hash ), $this->params['cipher'],
- $secret, 0, base64_decode( $this->args[0] )
- ) );
+ $decrypted = openssl_decrypt(
+ $this->hash, $this->params['cipher'],
+ $secret, 0, base64_decode( $this->args[0] ) );
+ if ( $decrypted === false ) {
+ throw new PasswordError( 'Error decrypting password: ' . openssl_error_string() );
+ }
+ $underlyingPassword = $this->factory->newFromCiphertext( $decrypted );