src/script/script.js
function validateSignature(sig, flags) {
  assert(Buffer.isBuffer(sig));
  assert(typeof flags === 'number');

  // Allow empty sigs
  if (sig.length === 0)
    return true;

  if ((flags & Script.flags.VERIFY_DERSIG)
      || (flags & Script.flags.VERIFY_LOW_S)
      || (flags & Script.flags.VERIFY_STRICTENC)) {
    if (!common.isSignatureEncoding(sig))
      throw new ScriptError('SIG_DER');
  }

  if (flags & Script.flags.VERIFY_LOW_S) {
    if (!common.isLowDER(sig))
      throw new ScriptError('SIG_HIGH_S');
  }

  if (flags & Script.flags.VERIFY_STRICTENC) {
    if (!common.isHashType(sig))
      throw new ScriptError('SIG_HASHTYPE');
  }

  return true;
}
function validateSignature(sig, flags) {
  assert(Buffer.isBuffer(sig));
  assert(typeof flags === 'number');

  // Allow empty sigs
  if (sig.length === 0)
    return true;

  if ((flags & Script.flags.VERIFY_DERSIG)
      || (flags & Script.flags.VERIFY_LOW_S)
      || (flags & Script.flags.VERIFY_STRICTENC)) {
    if (!common.isSignatureEncoding(sig))
      throw new ScriptError('SIG_DER');
  }

  if (flags & Script.flags.VERIFY_LOW_S) {
    if (!common.isLowDER(sig))
      throw new ScriptError('SIG_HIGH_S');
  }

  if (flags & Script.flags.VERIFY_STRICTENC) {
    if (!common.isHashType(sig))
      throw new ScriptError('SIG_HASHTYPE');
  }

  return true;
}
function validateSignature ( sig , flags ) { assert ( Buffer . isBuffer ( sig ) ) ; assert ( typeof flags === 'number' ) ; // Allow empty sigs if ( sig . length === 0 ) return true ; if ( ( flags & Script . flags . VERIFY_DERSIG ) || ( flags & Script . flags . VERIFY_LOW_S ) || ( flags & Script . flags . VERIFY_STRICTENC ) ) { if ( ! common . isSignatureEncoding ( sig ) ) throw new ScriptError ( 'SIG_DER' ) ; } if ( flags & Script . flags . VERIFY_LOW_S ) { if ( ! common . isLowDER ( sig ) ) throw new ScriptError ( 'SIG_HIGH_S' ) ; } if ( flags & Script . flags . VERIFY_STRICTENC ) { if ( ! common . isHashType ( sig ) ) throw new ScriptError ( 'SIG_HASHTYPE' ) ; } return true ; }
Test whether the data element is a valid signature based
on the encoding, S value, and sighash type. Requires
VERIFY_DERSIG|VERIFY_LOW_S|VERIFY_STRICTENC, VERIFY_LOW_S
and VERIFY_STRING_ENC to be enabled respectively. Note that
this will allow zero-length signatures.
@param {Buffer} sig
@param {VerifyFlags?} flags
@returns {Boolean}
@throws {ScriptError}
Test whether the data element is a valid signature based on the encoding S value and sighash type . Requires VERIFY_DERSIG|VERIFY_LOW_S|VERIFY_STRICTENC VERIFY_LOW_S and VERIFY_STRING_ENC to be enabled respectively . Note that this will allow zero - length signatures .