You are here

public static function CryptConnector::createDerivedKey in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/CryptConnector.php \Drupal\acquia_connector\CryptConnector::createDerivedKey()
  2. 3.x src/CryptConnector.php \Drupal\acquia_connector\CryptConnector::createDerivedKey()

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

Parameters

string $salt: Salt.

string $id: Acquia Subscription ID.

string $key: Acquia Subscription Key.

Return value

string Derived Key.

2 calls to CryptConnector::createDerivedKey()
AcquiaSearchTest::setUp in acquia_search/tests/src/Unit/AcquiaSearchTest.php
SearchSubscriber::getDerivedKey in acquia_search/src/EventSubscriber/SearchSubscriber.php
Get the derived key.

File

src/CryptConnector.php, line 98

Class

CryptConnector
Class CryptConnector.

Namespace

Drupal\acquia_connector

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);
}