public function setAlgorithm($algorithm)
    {
        $algorithms = array(
            'HS256' => 'sha256',
            'HS384' => 'sha384',
            'HS512' => 'sha512',
            'none'  => false
        );

        if (!isset($algorithms[$algorithm])) {
            throw new DomainException('Algorithm not supported');
        }

        $this->_header['alg'] = $algorithm;
        $this->_algorithm     = $algorithms[$algorithm];

        return $this;
    }