Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function decrypt($encryptedText, $key) { |
||
15 | $method = 'AES-256-GCM'; |
||
16 | $encryptedText = hex2bin( $encryptedText ); |
||
17 | $iv_len = $tag_length = 16; |
||
18 | $iv = substr( $encryptedText, 0, $iv_len ); |
||
19 | $tag = substr( $encryptedText, -$tag_length, $iv_len ); |
||
20 | $ciphertext = substr( $encryptedText, $iv_len, -$tag_length ); |
||
21 | |||
22 | return openssl_decrypt( $ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag ); |
||
23 | } |
||
24 | } |