You are here

public static function AcquiaCryptConnector::createDerivedKey in Acquia Search 3.x

Derive a key for the solr hmac using a salt, id and key.

Parameters

string $salt: Salt.

string $id: Acquia Search Core ID.

string $key: Acquia Subscription Key.

Return value

string Derived Key.

2 calls to AcquiaCryptConnector::createDerivedKey()
AcquiaCryptConnectorTest::testAcquiaCryptConnector in tests/src/Unit/AcquiaCryptConnectorTest.php
Test AcquiaCryptConnector::createDerivedKey().
SearchSubscriber::getDerivedKey in src/EventSubscriber/SearchSubscriber.php
Get the derived key.

File

src/AcquiaCryptConnector.php, line 25

Class

AcquiaCryptConnector
Class CryptConnector.

Namespace

Drupal\acquia_search

Code

public static function createDerivedKey($salt, $id, $key) {
  $derivation_string = $id . 'solr' . $salt;
  return hash_hmac('sha1', str_pad($derivation_string, 80, $derivation_string), $key);
}