本文整理汇总了PHP中Crypt::generateHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt::generateHeader方法的具体用法?PHP Crypt::generateHeader怎么用?PHP Crypt::generateHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crypt
的用法示例。
在下文中一共展示了Crypt::generateHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPrivateSystemKey
/**
* write private system key (recovery and public share key) to disk
*
* @param string $key encrypted key
* @param string $keyName name of the key
* @return boolean
*/
public static function setPrivateSystemKey($key, $keyName)
{
$keyName = $keyName . '.privateKey';
$header = Crypt::generateHeader();
return self::setKey(self::$encryption_base_dir, $keyName, $header . $key, new \OC\Files\View());
}
示例2: setPrivateSystemKey
/**
* write private system key (recovery and public share key) to disk
*
* @param string $key encrypted key
* @param string $keyName name of the key file
* @return boolean
*/
public static function setPrivateSystemKey($key, $keyName)
{
$header = Crypt::generateHeader();
$view = new \OC\Files\View('/owncloud_private_key');
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
if (!$view->file_exists('')) {
$view->mkdir('');
}
$result = $view->file_put_contents($keyName, $header . $key);
\OC_FileProxy::$enabled = $proxyStatus;
return $result;
}
示例3: writeHeader
/**
* write header at beginning of encrypted file
*
* @throws Exceptions\EncryptionException
*/
private function writeHeader()
{
$header = Crypt::generateHeader();
if (strlen($header) > Crypt::BLOCKSIZE) {
throw new Exceptions\EncryptionException('max header size exceeded', 30);
}
$paddedHeader = str_pad($header, Crypt::BLOCKSIZE, self::PADDING_CHAR, STR_PAD_RIGHT);
fwrite($this->handle, $paddedHeader);
$this->headerWritten = true;
}