protected function MarstonEncryption::convertKey in Ubercart 8.4
Converts encryption key into an array of numbers.
Parameters
string $key: Encryption key.
Return value
array|null Array of integers.
2 calls to MarstonEncryption::convertKey()
- MarstonEncryption::decrypt in uc_store/
src/ MarstonEncryption.php - Decrypts cyphertext.
- MarstonEncryption::encrypt in uc_store/
src/ MarstonEncryption.php - Encrypts plaintext.
File
- uc_store/
src/ MarstonEncryption.php, line 237
Class
- MarstonEncryption
- Deprecated. Handles encryption of credit-card information.
Namespace
Drupal\uc_storeCode
protected function convertKey($key) {
if (empty($key)) {
// Commented out to prevent errors getting logged for use cases that may
// have variable encryption/decryption requirements.
/* $this->errors[] = 'No value has been supplied for the encryption key'; */
return;
}
$array[] = strlen($key);
$tot = 0;
for ($i = 0; $i < strlen($key); $i++) {
$char = substr($key, $i, 1);
$num = strpos(self::$scramble1, $char);
if ($num === FALSE) {
$this->errors[] = t('Key contains an invalid character (@char)', [
'@char' => $char,
]);
return;
}
$array[] = $num;
$tot = $tot + $num;
}
$array[] = $tot;
return $array;
}