/** * Create a new {@code AtomicLoadKeyStore} instance that wraps specified {@link KeyStore}. * * @param keyStore the {@link KeyStore} to be wrapped * @return the new {@code AtomicLoadKeyStore} instance */ public static AtomicLoadKeyStore atomize(KeyStore keyStore) throws CertificateException, NoSuchAlgorithmException, IOException { final String type = keyStore.getType(); final Provider provider = keyStore.getProvider(); AtomicLoadKeyStoreSpi keyStoreSpi = new AtomicLoadKeyStoreSpi(() -> KeyStore.getInstance(type, provider)); AtomicLoadKeyStore result = new AtomicLoadKeyStore(keyStoreSpi, provider, type); result.load(null, null); result.setKeyStore(keyStore); return result; }