normalize method

ECSignature normalize(
  1. ECDomainParameters curveParams
)
inherited

'normalize' this signature by converting its s to lower-s form if necessary This is required to validate this signature with some libraries such as libsecp256k1 which enforce lower-s form for all signatures to combat ecdsa signature malleability

Returns this if the signature was already normalized, or a copy if it is changed.

Implementation

ECSignature normalize(ECDomainParameters curveParams) {
  if (isNormalized(curveParams)) {
    return this;
  }
  return ECSignature(r, curveParams.n - s);
}