‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue Class Reference
Inheritance diagram for TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue:
TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceInterface

Public Member Functions

 __construct (string $value, public readonly HashType $type=HashType::sha256)
 
 __toString ()
 
 compile (?FrontendInterface $cache=null)
 
 serialize ()
 

Static Public Member Functions

static hash (string $payload, HashType $type=HashType::sha256)
 
static create (string $value, HashType $type=HashType::sha256)
 
static knows (string $value)
 
static parse (string $value)
 

Public Attributes

readonly string $value
 

Static Private Member Functions

static createParsingPattern ()
 

Detailed Description

Representation of Content-Security-Policy hash source value see https://www.w3.org/TR/CSP3/#grammardef-hash-source

Definition at line 26 of file HashValue.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::__construct ( string  $value,
public readonly HashType  $type = HashType::sha256 
)
Parameters
string$value‪hash value (binary, hex or base64 encoded)
HashType$type

Definition at line 45 of file HashValue.php.

References TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue\$value.

Member Function Documentation

◆ __toString()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::__toString ( )

Definition at line 58 of file HashValue.php.

◆ compile()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::compile ( ?FrontendInterface  $cache = null)

Compiled representation to be used for Content-Security-Policy HTTP header.

Returns
‪?string null means "not applicable / skip"

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 82 of file HashValue.php.

◆ create()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::create ( string  $value,
HashType  $type = HashType::sha256 
)
static

◆ createParsingPattern()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::createParsingPattern ( )
staticprivate

Definition at line 76 of file HashValue.php.

◆ hash()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::hash ( string  $payload,
HashType  $type = HashType::sha256 
)
static

◆ knows()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::knows ( string  $value)
static

Determines whether a serialized representation is known and can be handled by a specific implementation, (e.g. "string starts with 'hash-proxy-").

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 63 of file HashValue.php.

References TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue\$value.

◆ parse()

static TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::parse ( string  $value)
static

Parses a known serialized representation as object representation.

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 68 of file HashValue.php.

References TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue\$value.

◆ serialize()

TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue::serialize ( )

Serialized representation to be used for persisting declaration (e.g. in database).

Returns
‪?string null means "not applicable / skip"

Implements TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceValueInterface.

Definition at line 87 of file HashValue.php.

Member Data Documentation

◆ $value