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);
}