private static String getRSAPublicKey(KeyPair rsaKeyPair) {

		RSAPublicKey rsaPublicKey = (RSAPublicKey) rsaKeyPair.getPublic();
		String keyAlgorithm = "ssh-rsa";

		ByteArrayOutputStream out = new ByteArrayOutputStream();
		sshBuilderWriteString(keyAlgorithm, out);
		BigInteger e = rsaPublicKey.getPublicExponent();
		byte[] data = e.toByteArray();
		sshBuilderWriteUInt32(data.length, out);
		out.writeBytes(data);
		BigInteger m = rsaPublicKey.getModulus();
		data = m.toByteArray();
		sshBuilderWriteUInt32(data.length, out);
		out.writeBytes(data);
		byte[] bytesOut = out.toByteArray();

		String publicKeyEncoded = new String(Base64.getEncoder().encodeToString(bytesOut));
		return keyAlgorithm + " " + publicKeyEncoded + " test\n";
	}
Generate SSH RSA public key file content
@param rsaKeyPair SSH public/private key pair
@return SSH public key file content string
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/server/remote/SSHKeyUtil.java