public static final PrivateKeyEntry createKeyEntry(String alias, String dn, int durationDays,
			PrivateKeyEntry caEntry, File keyFile, String keystoreType,
			Collection<String> subjectAlternativeNames, char[] protectedPassphrase)
			throws KeyStoreException {

		PasswordProtection pp = new PasswordProtection(protectedPassphrase);
		try {
			KeyStore keyStore = createKeyStore(alias, dn, durationDays, caEntry, keyFile,
				keystoreType, subjectAlternativeNames, protectedPassphrase);
			return (PrivateKeyEntry) keyStore.getEntry(alias, pp);
		}
		catch (NoSuchAlgorithmException | UnrecoverableEntryException e) {
			throw new KeyStoreException("Failed to generate/store certificate (" + dn + ")", e);
		}
		finally {
			try {
				pp.destroy();
			}
			catch (DestroyFailedException e) {
				throw new AssertException(e); // unexpected for simple password clearing
			}
		}
	}
Generate a new {@link X509Certificate} with RSA {@link KeyPair} and create/update a {@link KeyStore}
optionally backed by a keyFile.  
@param alias entry alias with keystore
@param dn distinguished name (e.g., "CN=Ghidra Test, O=Ghidra, OU=Test, C=US" )
@param durationDays number of days which generated certificate should remain valid
@param caEntry optional CA private key entry.  If null, a self-signed CA certificate will be generated.
@param keyFile optional file to load/store resulting {@link KeyStore} (may be null)
@param keystoreType support keystore type (e.g., "JKS", "PKCS12")
@param subjectAlternativeNames an optional list of subject alternative names to be included 
			in certificate (may be null)
@param protectedPassphrase key and keystore protection password
@return newly generated keystore entry with key pair
@throws KeyStoreException if error occurs while updating keystore
Ghidra/Framework/Generic/src/main/java/ghidra/net/ApplicationKeyManagerUtils.java