public static void storeKeyFile(final KeyPair keyPair, final Path homeDirectory) {
    try {
      storeKeyPair(keyPair, getDefaultKeyFile(homeDirectory));
    } catch (IOException e) {
      throw new IllegalArgumentException("Cannot store generated private key.");
    }
  }
Store key file.

@param keyPair the key pair
@param homeDirectory the home directory
crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/KeyPairUtil.java