private static void generatePkiCerts() throws Exception {

		String caPath = getTestPkiCACertsPath(); // CA certs keystore is .jks file
		File caFile = new File(caPath);
		if (caFile.exists() && !caFile.delete()) {
			throw new RuntimeException("Failed to generate new test-CA key file: " + caPath);
		}

		String userKeystorePath = getTestPkiUserKeystorePath(); // user keystore is .p12 file
		File userKeystoreFile = new File(userKeystorePath);
		if (userKeystoreFile.exists() && !userKeystoreFile.delete()) {
			throw new RuntimeException(
				"Failed to generate new test-user key file: " + userKeystorePath);
		}

		String serverKeystorePath = getTestPkiServerKeystorePath(); // server keystore is .p12 file
		File serverKeystoreFile = new File(serverKeystorePath);
		if (serverKeystoreFile.exists() && !serverKeystoreFile.delete()) {
			throw new RuntimeException(
				"Failed to generate new test-server key file: " + serverKeystorePath);
		}

		// Generate CA certificate and keystore
		Msg.info(ServerTestUtil.class, "Generating self-signed CA cert: " + caPath);
		PrivateKeyEntry caEntry =
			ApplicationKeyManagerUtils.createKeyEntry("test-CA", TEST_PKI_CA_DN, 2, null, null,
				"PKCS12", null, ApplicationKeyManagerFactory.DEFAULT_PASSWORD.toCharArray());
		ApplicationKeyManagerUtils.exportX509Certificates(caEntry.getCertificateChain(), caFile);

		// Generate User/Client certificate and keystore
		Msg.info(ServerTestUtil.class, "Generating test user key/cert (signed by test-CA, pwd: " +
			TEST_PKI_USER_PASSPHRASE + "): " + userKeystorePath);
		ApplicationKeyManagerUtils.createKeyEntry("test-sig", TEST_PKI_USER_DN, 2, caEntry,
			userKeystoreFile, "PKCS12", null, TEST_PKI_USER_PASSPHRASE.toCharArray());

		// Generate Server certificate and keystore
		Msg.info(ServerTestUtil.class, "Generating test server key/cert (signed by test-CA, pwd: " +
			TEST_PKI_SERVER_PASSPHRASE + "): " + serverKeystorePath);

		ApplicationKeyManagerUtils.createKeyEntry("test-sig", TEST_PKI_SERVER_DN, 2, caEntry,
			serverKeystoreFile, "PKCS12", null, TEST_PKI_SERVER_PASSPHRASE.toCharArray());
	}
Generate self-signed test-CA key/certificate and a test user key/certificate
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/server/remote/ServerTestUtil.java