private synchronized boolean init(String newKeystorePath) throws CancelledException {

			if (wrappedKeyManager != null) {
				if (StringUtils.equals(keystorePath, newKeystorePath)) {
					return true;
				}
				invalidateKey();
			}

			ProtectedKeyStoreData keystoreData = null;
			try {
				if (newKeystorePath != null && newKeystorePath.length() != 0) {
					keystoreData = getProtectedKeyStoreData(newKeystorePath);
				}
				else if (defaultIdentity != null) {
					// use self-signed keystore as fallback (intended for server use only)
					Msg.info(this, "Using self-signed certificate: " + defaultIdentity.getName());
					char[] pwd = DEFAULT_PASSWORD.toCharArray();
					KeyStore selfSignedKeyStore =
						ApplicationKeyManagerUtils.createKeyStore("defaultSigKey",
							defaultIdentity.getName(), SELF_SIGNED_DURATION_DAYS, null, null, "JKS",
							subjectAlternativeNames, pwd);
					keystoreData = new ProtectedKeyStoreData(selfSignedKeyStore, pwd);
					isSelfSigned = true;
				}
				else {
					return false;
				}

				ApplicationKeyStore.logCerts(keystoreData.keyStore);

				KeyManagerFactory kmf =
					KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
				kmf.init(keystoreData.keyStore, keystoreData.password);

				// Assume that one keystore will produce at most one KeyManager
				KeyManager[] keyManagers = kmf.getKeyManagers();
				if (keyManagers.length == 1 && (keyManagers[0] instanceof X509KeyManager)) {
					wrappedKeyManager = (X509KeyManager) keyManagers[0];
					keystorePath = newKeystorePath; // update current keystore path
					return true;
				}

				isSelfSigned = false;

				if (keyManagers.length == 0) {
					Msg.showError(this, null, "PKI Keystore Failure",
						"Failed to create PKI key manager: failed to process keystore (no keys processed)");
				}
				else if (keyManagers.length == 1) {
					Msg.showError(this, null, "PKI Keystore Failure",
						"Failed to create PKI key manager: failed to process keystore (expected X.509)");
				}
				else {
					// Unexpected condition
					Msg.showError(this, null, "PKI Keystore Failure",
						"Failed to create PKI key manager: unsupported keystore produced multiple KeyManagers");
				}
			}
			catch (CancelledException e) {
				throw e;
			}
			catch (Exception e) {
				Msg.showError(this, null, "PKI Keystore Failure",
					"Failed to create PKI key manager: " + e.getMessage(), e);
			}
			finally {
				if (keystoreData != null) {
					keystoreData.dispose();
					keystoreData = null;
				}
			}
			return false;
		}
Initialize the x509KeyManager.
If the <code>x509KeyManager</code> already exists for the specified keystore path,
this method has no affect.  If no keystore has been identified and the Default Identity
has been set, a self-signed certificate will be generated.  If nothing has been set, the
wrappedKeyManager will remain null and false will be returned.  If an error occurs it
will be logged and key managers will remain uninitialized.
@param newKeystorePath specifies the keystore to be opened or null for no keystore
@return true if key manager initialized successfully or was previously initialized, else
false if new keystore path was not specified and default identity for self-signed certificate
has not be established (see {@link ApplicationKeyManagerFactory#setDefaultIdentity(X500Principal)}).
@throws CancelledException user cancelled keystore password entry request
Ghidra/Framework/Generic/src/main/java/ghidra/net/ApplicationKeyManagerFactory.java