protected function initSignature()
    {
        if (!$this->getRequestParameters()->has($this->parameters['hmac']['signature_name'])) {
            $this->logger->error('Payment signature not set.');

            return false;
        }

        $signature = $this->getRequestParameters()->get($this->parameters['hmac']['signature_name']);
        $signatureLength = strlen($signature);

        if ($signatureLength > 172) {
            $this->signature = base64_decode(urldecode($signature));

            return true;
        } elseif ($signatureLength == 172) {
            $this->signature = base64_decode($signature);

            return true;
        } elseif ($signatureLength == 128) {
            $this->signature = $signature;

            return true;
        } else {
            $this->signature = null;
            $this->logger->error('Bad signature format.');

            return false;
        }
    }