本文整理汇总了PHP中Magento\Framework\Encryption\EncryptorInterface::exportKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP EncryptorInterface::exportKeys方法的具体用法?PHP EncryptorInterface::exportKeys怎么用?PHP EncryptorInterface::exportKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Encryption\EncryptorInterface
的用法示例。
在下文中一共展示了EncryptorInterface::exportKeys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeEncryptionKey
/**
* Change encryption key
*
* @param string|null $key
* @return null|string
* @throws \Exception
*/
public function changeEncryptionKey($key = null)
{
// prepare new key, encryptor and new configuration segment
if (!$this->writer->checkIfWritable()) {
throw new \Exception(__('Deployment configuration file is not writable.'));
}
if (null === $key) {
$key = md5(time());
}
$this->encryptor->setNewKey($key);
$encryptSegment = new ConfigData(ConfigFilePool::APP_ENV);
$encryptSegment->set(ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY, $this->encryptor->exportKeys());
$configData = [$encryptSegment->getFileKey() => $encryptSegment->getData()];
// update database and config.php
$this->beginTransaction();
try {
$this->_reEncryptSystemConfigurationValues();
$this->_reEncryptCreditCardNumbers();
$this->writer->saveConfig($configData);
$this->commit();
return $key;
} catch (\Exception $e) {
$this->rollBack();
throw $e;
}
}