@Override
  public SECPSignature sign(final Bytes32 dataHash, final KeyPair keyPair) {
    final ECDSASigner signer = new ECDSASigner(getKCalculator());

    final ECPrivateKeyParameters privKey =
        new ECPrivateKeyParameters(
            keyPair.getPrivateKey().getEncodedBytes().toUnsignedBigInteger(), curve);
    signer.init(true, privKey);

    final BigInteger[] components = signer.generateSignature(dataHash.toArrayUnsafe());

    return normaliseSignature(components[0], components[1], keyPair.getPublicKey(), dataHash);
  }
Given the components of a signature and a selector value, recover and return the public key
that generated the signature according to the algorithm in SEC1v2 section 4.1.6.

<p>If this method returns null it means recovery was not possible and recId should be iterated.

<p>Given the above two points, a correct usage of this method is inside a for loop from 0 to 3,
and if the output is null OR a key that is not the one you expect, you try again with the next
recId.

@param recId Which possible key to recover.
@param r The R component of the signature.
@param s The S component of the signature.
@param dataHash Hash of the data that was signed.
@return An ECKey containing only the public part, or null if recovery wasn't possible.
crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/AbstractSECP256.java