Jose\Algorithm\Signature\ECDSA::getOpenSSLSignature PHP Method

getOpenSSLSignature() private method

private getOpenSSLSignature ( Jose\Object\JWKInterface $key, string $data ) : string
$key Jose\Object\JWKInterface
$data string
return string
    private function getOpenSSLSignature(JWKInterface $key, $data)
    {
        $pem = (new ECKey($key))->toPEM();
        $result = openssl_sign($data, $signature, $pem, $this->getHashAlgorithm());
        Assertion::true($result, 'Signature failed');
        $asn = Object::fromBinary($signature);
        Assertion::isInstanceOf($asn, Sequence::class, 'Invalid signature');
        $res = '';
        foreach ($asn->getChildren() as $child) {
            Assertion::isInstanceOf($child, Integer::class, 'Invalid signature');
            $res .= str_pad($this->convertDecToHex($child->getContent()), $this->getSignaturePartLength(), '0', STR_PAD_LEFT);
        }
        return $this->convertHexToBin($res);
    }