public static KeyManagerFactory loadKeyManagerFactory(
            final String keyStoreFormat,
            final Resource keyStore,
            final String keyStorePassword)
            throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException,
            UnrecoverableKeyException {

        final KeyStore ks = loadKeyStore(keyStoreFormat, keyStore, keyStorePassword);
        final String keyManagerAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
        final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(keyManagerAlgorithm);
        keyManagerFactory.init(ks, keystorePassword(keyStorePassword));
        return keyManagerFactory;
    }
Creates a new {@link KeyManagerFactory} from the given {@link KeyStore} {@link Resource}.

@param keyStoreFormat The format of the keystore.
@param keyStore The resource containing the keystore.
@param keyStorePassword The password for the keystore. May be empty or null.
@return The newly created KeyManagerFactory.
@throws KeyStoreException If the keystore format isn't supported.
@throws IOException If there is an I/O or format problem with the keystore data, if a password is required but
        not given, or if the given password was incorrect. If the error is due to a wrong password, the
        {@link Throwable#getCause cause} of the {@code IOException} should be an
        {@code UnrecoverableKeyException}
@throws NoSuchAlgorithmException If the algorithm used to check the integrity of the keystore cannot be found
@throws CertificateException If any of the certificates in the keystore could not be loaded
@throws UnrecoverableKeyException If the key cannot be recovered(e.g. the given password is wrong).
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/security/KeyStoreUtils.java