20 lines
363 B
PHP
20 lines
363 B
PHP
<?php
|
|
|
|
namespace NoccyLabs\SimpleJWT\Key;
|
|
|
|
class JWTDerivedKey implements KeyInterface
|
|
{
|
|
private $key;
|
|
|
|
public function __construct(string $password, string $salt, int $iter=100)
|
|
{
|
|
$this->key = hash_pbkdf2("sha256", $password, $salt, $iter, 0, true);
|
|
}
|
|
|
|
public function getBinaryKey(): string
|
|
{
|
|
return $this->key;
|
|
}
|
|
}
|
|
|