Bitrix API

HmacAlgorithm extends SigningAlgorithm

Class HmacAlgorithm

Tags
since
14.0.7

Table of Contents

Methods

__construct()  : mixed
Creates signing algorithm based on HMAC.
getHashAlgorithm()  : string
Return currently used hashing algorithm
getSignature()  : string
Return message signature
setHashAlgorithm()  : $this
Set hashing algorithm for using in HMAC
verify()  : bool
Verify message signature

Methods

__construct()

Creates signing algorithm based on HMAC.

public __construct([string|null $hashAlgorithm = null ]) : mixed
Parameters
$hashAlgorithm : string|null = null

Hashing algorithm (optional). See registered algorithms in hash_algos().

Tags
since
16.0.0

getHashAlgorithm()

Return currently used hashing algorithm

public getHashAlgorithm() : string
Return values
string

getSignature()

Return message signature

public getSignature(string $value, string $key) : string
Parameters
$value : string

Message.

$key : string

Secret password for HMAC.

Return values
string

setHashAlgorithm()

Set hashing algorithm for using in HMAC

public setHashAlgorithm(string $hashAlgorithm) : $this
Parameters
$hashAlgorithm : string

Hashing algorithm. See registered algorithms in hash_algos().

Tags
throws
ArgumentOutOfRangeException
Return values
$this

verify()

Verify message signature

public verify(string $value, string $key, string $sig) : bool
Parameters
$value : string

Message.

$key : string

Secret password used while signing.

$sig : string

Message signature password for HMAC.

Return values
bool

        
On this page

Search results