Class Key
Class Key
Wraps a string to keep it hidden from stack traces.
Methods Summary
-
__debugInfo ( )
Hide contents of
-
__construct ( string $str )
Key constructor.
-
__destruct ( )
Defense in depth:
- get ( )
- length ( )
Methods Details
array __debugInfo ( )
Hide contents of
Returns
array |
__construct ( string $str )
Key constructor.
Parameters
string | $str |
__destruct ( )
Defense in depth:
PHP 7.2 includes the Sodium cryptography library, which (among other things) exposes a function called sodium_memzero() that we can use to zero-fill strings to minimize the risk of sensitive cryptographic materials persisting in memory.
If this function is not available, we XOR the string in-place with itself as a best-effort attempt.
string get ( )
Returns
string |
integer length ( )
Returns
integer |