code: public void save(final KeyPair keyPair) throws IOException {
          LOGGER.info("Saving key pair");
          final PrivateKey privateKey = keyPair.getPrivate();
          final PublicKey publicKey = keyPair.getPublic();
  
          // Store Public Key
          final File publicKeyFile = getKeyPath(publicKey);
          publicKeyFile.getParentFile().mkdirs(); // make directories if they do not exist
          final X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(publicKey.getEncoded());
          try (OutputStream fos = Files.newOutputStream(publicKeyFile.toPath())) {
              fos.write(x509EncodedKeySpec.getEncoded());
          }
  
          // Store Private Key.
          final File privateKeyFile = getKeyPath(privateKey);
          privateKeyFile.getParentFile().mkdirs(); // make directories if they do not exist
          final PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(privateKey.getEncoded());
          try (OutputStream fos = Files.newOutputStream(privateKeyFile.toPath())) {
              fos.write(pkcs8EncodedKeySpec.getEncoded());
          }
      }
docs: Saves a key pair.
  
  @param keyPair the key pair to save
  @throws IOException if the files cannot be written
  @since 1.0.0