PHP Class ParagonIE\Halite\HiddenString

The purpose of this class is to encapsulate strings and hide their contents from stack traces should an unhandled exception occur in a program that uses Halite. The only things that should be protected: - Passwords - Plaintext (before encryption) - Plaintext (after decryption) This library makes heavy use of return-type declarations, which are a PHP 7 only feature. Read more about them here:
Mostra file Open project: paragonie/halite Class Usage Examples

Protected Properties

Property Type Description
$disallowInline boolean Disallow the contents from being accessed via __toString()?
$disallowSerialization boolean Disallow the contents from being accessed via __sleep()?
$internalStringValue string

Public Methods

Method Description
__construct ( string $value, boolean $disallowInline = false, boolean $disallowSerialization = false ) HiddenString constructor.
__debugInfo ( ) : array Hide its internal state from var_dump()
__destruct ( ) Wipe it from memory after it's been used.
__sleep ( ) : array
__toString ( ) : string Returns a copy of the string's internal value, which should be zeroed.
getString ( ) : string Explicit invocation -- get the raw string value

Method Details

__construct() public method

HiddenString constructor.
public __construct ( string $value, boolean $disallowInline = false, boolean $disallowSerialization = false )
$value string
$disallowInline boolean
$disallowSerialization boolean

__debugInfo() public method

Hide its internal state from var_dump()
public __debugInfo ( ) : array
return array

__destruct() public method

Wipe it from memory after it's been used.
public __destruct ( )

__sleep() public method

public __sleep ( ) : array
return array

__toString() public method

Optionally, it can return an empty string.
public __toString ( ) : string
return string

getString() public method

Explicit invocation -- get the raw string value
public getString ( ) : string
return string

Property Details

$disallowInline protected_oe property

Disallow the contents from being accessed via __toString()?
protected bool $disallowInline
return boolean

$disallowSerialization protected_oe property

Disallow the contents from being accessed via __sleep()?
protected bool $disallowSerialization
return boolean

$internalStringValue protected_oe property

protected string $internalStringValue
return string