code: private KeyStore getKeyStoreWithSingleKey(KeyStore keyStore, String keyStorePassword, String keyAlias)
              throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException {
          KeyStore singleKeyKeyStore = KeyStore.getInstance(keyStore.getType(), keyStore.getProvider());
          final char[] password = keyStorePassword.toCharArray();
          singleKeyKeyStore.load(null, password);
          Key key = keyStore.getKey(keyAlias, password);
          Certificate[] chain = keyStore.getCertificateChain(keyAlias);
          singleKeyKeyStore.setKeyEntry(keyAlias, key, password, chain);
          return singleKeyKeyStore;
      }
docs: /*
  Workaround for keystores containing multiple keys. Java will take the first key that matches
  and this way we can still offer configuration for a keystore with multiple keys and a selection
  based on alias. Also much easier than making a subclass of a KeyManagerFactory