@Override
    protected void engineInit(KeyStore ks, char[] password)
            throws KeyStoreException, NoSuchAlgorithmException,
            UnrecoverableKeyException {
        if (ks != null) {
            keyStore = ks;
            if (password != null) {
                pwd = password.clone();
            } else {
                pwd = EmptyArray.CHAR;
            }
        } else {
            keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
            String keyStoreName = System.getProperty("javax.net.ssl.keyStore");
            String keyStorePwd = null;
            if (keyStoreName == null || keyStoreName.equalsIgnoreCase("NONE") || keyStoreName.isEmpty()) {
                try {
                    keyStore.load(null, null);
                } catch (IOException e) {
                    throw new KeyStoreException(e);
                } catch (CertificateException e) {
                    throw new KeyStoreException(e);
                }
            } else {
                keyStorePwd = System.getProperty("javax.net.ssl.keyStorePassword");
                if (keyStorePwd == null) {
                    pwd = EmptyArray.CHAR;
                } else {
                    pwd = keyStorePwd.toCharArray();
                }
                FileInputStream fis = null;
                try {
                    fis = new FileInputStream(new File(keyStoreName));
                    keyStore.load(fis, pwd);
                } catch (FileNotFoundException e) {
                    throw new KeyStoreException(e);
                } catch (IOException e) {
                    throw new KeyStoreException(e);
                } catch (CertificateException e) {
                    throw new KeyStoreException(e);
                } finally {
                    IoUtils.closeQuietly(fis);
                }
            }

        }

    }
@see KeyManagerFactorySpi#engineInit(KeyStore ks, char[] password)
common/src/main/java/org/conscrypt/KeyManagerFactoryImpl.java