public static KeyPair loadKeyPair(final File keyFile) {

    final KeyPair key;
    if (keyFile.exists()) {

      LOG.info("Attempting to load public key from {}", keyFile.getAbsolutePath());
      key = load(keyFile);
      LOG.info(
          "Loaded public key {} from {}", key.getPublicKey().toString(), keyFile.getAbsolutePath());
    } else {
      final SignatureAlgorithm signatureAlgorithm = SIGNATURE_ALGORITHM.get();
      key = signatureAlgorithm.generateKeyPair();
      storeKeyFile(key, keyFile.getParentFile().toPath());

      LOG.info(
          "Generated new {} public key {} and stored it to {}",
          signatureAlgorithm.getCurveName(),
          key.getPublicKey().toString(),
          keyFile.getAbsolutePath());
    }
    return key;
  }
Load key pair.

@param keyFile the key file
@return the key pair
crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/KeyPairUtil.java