/** * @param Buffer $signature * @return bool * @throws ScriptRuntimeException * @throws \Exception */ public function isLowDerSignature(Buffer $signature) { if (!$this->isValidSignatureEncoding($signature)) { throw new ScriptRuntimeException(InterpreterInterface::VERIFY_DERSIG, 'Signature with incorrect encoding'); } $binary = $signature->getBinary(); $nLenR = ord($binary[3]); $nLenS = ord($binary[5 + $nLenR]); $s = $signature->slice(6 + $nLenR, $nLenS)->getInt(); return $this->ecAdapter->validateSignatureElement($s, true); }