protected function signString($privateKey, $data, $forceOpenssl = false)
    {
        $signature = '';

        if (class_exists(RSA::class) && !$forceOpenssl) {
            $rsa = new RSA;
            $rsa->loadKey($privateKey);
            $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1);
            $rsa->setHash('sha256');

            $signature = $rsa->sign($data);
        } elseif (extension_loaded('openssl')) {
            openssl_sign($data, $signature, $privateKey, 'sha256WithRSAEncryption');
        } else {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('OpenSSL is not installed.');
        }
        // @codeCoverageIgnoreEnd

        return $signature;
    }