|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the tiqr project. |
|
4
|
|
|
* |
|
5
|
|
|
* The tiqr project aims to provide an open implementation for |
|
6
|
|
|
* authentication using mobile devices. It was initiated by |
|
7
|
|
|
* SURFnet and developed by Egeniq. |
|
8
|
|
|
* |
|
9
|
|
|
* More information: http://www.tiqr.org |
|
10
|
|
|
* |
|
11
|
|
|
* @author Peter Verhage <[email protected]> |
|
12
|
|
|
* |
|
13
|
|
|
* @package tiqr |
|
14
|
|
|
* |
|
15
|
|
|
* @license New BSD License - See LICENSE file for details. |
|
16
|
|
|
* |
|
17
|
|
|
* @copyright (C) 2010-2012 SURFnet BV |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
require_once 'Tiqr/UserSecretStorage/Encryption/Interface.php'; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Class for encrypting/decrypting the user secret with mcrypt. |
|
24
|
|
|
* |
|
25
|
|
|
* @author peter |
|
26
|
|
|
*/ |
|
27
|
|
|
class Tiqr_UserSecretStorage_Encryption_Mcrypt implements Tiqr_UserSecretStorage_Encryption_Interface |
|
28
|
|
|
{ |
|
29
|
|
|
private $_cipher; |
|
30
|
|
|
private $_mode; |
|
31
|
|
|
private $_key; |
|
32
|
|
|
private $_iv; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Construct an encryption instance. |
|
36
|
|
|
* |
|
37
|
|
|
* @param $config The configuration that a specific configuration class may use. |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct($config) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->_cipher = $config['cipher']; |
|
42
|
|
|
$this->_mode = $config['mode']; |
|
43
|
|
|
$this->_key = $config['key']; |
|
44
|
|
|
$this->_iv = $config['iv']; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Encrypts the given data. |
|
49
|
|
|
* |
|
50
|
|
|
* @param String $data Data to encrypt. |
|
51
|
|
|
* |
|
52
|
|
|
* @return encrypted data |
|
|
|
|
|
|
53
|
|
|
*/ |
|
54
|
|
|
public function encrypt($data) |
|
55
|
|
|
{ |
|
56
|
|
|
return bin2hex(mcrypt_encrypt($this->_cipher, $this->_key, $data, $this->_mode, $this->_iv)); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Decrypts the given data. |
|
61
|
|
|
* |
|
62
|
|
|
* @param String $data Data to decrypt. |
|
63
|
|
|
* |
|
64
|
|
|
* @return decrypted data |
|
|
|
|
|
|
65
|
|
|
*/ |
|
66
|
|
|
public function decrypt($data) |
|
67
|
|
|
{ |
|
68
|
|
|
return rtrim(mcrypt_decrypt($this->_cipher, $this->_key, pack("H*", $data), $this->_mode, $this->_iv), "\0"); |
|
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths