docs: public ECDSASignature doSign(byte[] input) {
          if (input.length != 32) {
              throw new IllegalArgumentException("Expected 32 byte input to ECDSA signature, not " + input.length);
          }
          // No decryption of private key required.
          if (privKey == null)
              throw new MissingPrivateKeyException();
          if (privKey instanceof BCECPrivateKey) {
              ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));
              ECPrivateKeyParameters privKeyParams = new ECPrivateKeyParameters(((BCECPrivateKey) privKey).getD(), CURVE);
              signer.init(true, privKeyParams);
              BigInteger[] components = signer.generateSignature(input);
              return new ECDSASignature(components[0], components[1]).toCanonicalised();
          } else {
              try {
                  final Signature ecSig = ECSignatureFactory.getRawInstance(provider);
                  ecSig.initSign(privKey);
                  ecSig.update(input);
                  final byte[] derSignature = ecSig.sign();
                  return ECDSASignature.decodeFromDER(derSignature).toCanonicalised();
              } catch (SignatureException | InvalidKeyException ex) {
                  throw new RuntimeException("ECKey signing error", ex);
              }
          }
      }