/** * Wrap an existing initialised {@link KeyStore} with an unmodifiable wrapper. * * Note: References are held to the underlying {@link KeyStore} can still be modified and changes will still be visible in * the representation returned here. * * @param toWrap the {@link KeyStore} to wrap. * @return the unmodifiable wrapper around the {@link KeyStore} * @throws NoSuchAlgorithmException * @throws CertificateException * @throws IOException * @throws IllegalArgumentException if the {@link KeyStore} being wrapped is {@code null} */ public static KeyStore unmodifiableKeyStore(final KeyStore toWrap) throws NoSuchAlgorithmException, CertificateException, IOException { Assert.checkNotNullParam("toWrap", toWrap); KeyStore keyStore = new UnmodifiableKeyStore(new UnmodifiableKeyStoreSpi(toWrap), toWrap.getProvider(), toWrap.getType()); keyStore.load(null, null); return keyStore; } }
/** * Wrap an existing initialised {@link KeyStore} with an unmodifiable wrapper. * * Note: References are held to the underlying {@link KeyStore} can still be modified and changes will still be visible in * the representation returned here. * * @param toWrap the {@link KeyStore} to wrap. * @return the unmodifiable wrapper around the {@link KeyStore} * @throws NoSuchAlgorithmException * @throws CertificateException * @throws IOException * @throws IllegalArgumentException if the {@link KeyStore} being wrapped is {@code null} */ public static KeyStore unmodifiableKeyStore(final KeyStore toWrap) throws NoSuchAlgorithmException, CertificateException, IOException { Assert.checkNotNullParam("toWrap", toWrap); KeyStore keyStore = new UnmodifiableKeyStore(new UnmodifiableKeyStoreSpi(toWrap), toWrap.getProvider(), toWrap.getType()); keyStore.load(null, null); return keyStore; } }
/** * Wrap an existing initialised {@link KeyStore} with an unmodifiable wrapper. * * Note: References are held to the underlying {@link KeyStore} can still be modified and changes will still be visible in * the representation returned here. * * @param toWrap the {@link KeyStore} to wrap. * @return the unmodifiable wrapper around the {@link KeyStore} * @throws NoSuchAlgorithmException * @throws CertificateException * @throws IOException * @throws IllegalArgumentException if the {@link KeyStore} being wrapped is {@code null} */ public static KeyStore unmodifiableKeyStore(final KeyStore toWrap) throws NoSuchAlgorithmException, CertificateException, IOException { Assert.checkNotNullParam("toWrap", toWrap); KeyStore keyStore = new UnmodifiableKeyStore(new UnmodifiableKeyStoreSpi(toWrap), toWrap.getProvider(), toWrap.getType()); keyStore.load(null, null); return keyStore; } }
/** * Wrap an existing initialised {@link KeyStore} with an unmodifiable wrapper. * * Note: References are held to the underlying {@link KeyStore} can still be modified and changes will still be visible in * the representation returned here. * * @param toWrap the {@link KeyStore} to wrap. * @return the unmodifiable wrapper around the {@link KeyStore} * @throws NoSuchAlgorithmException * @throws CertificateException * @throws IOException * @throws IllegalArgumentException if the {@link KeyStore} being wrapped is {@code null} */ public static KeyStore unmodifiableKeyStore(final KeyStore toWrap) throws NoSuchAlgorithmException, CertificateException, IOException { Assert.checkNotNullParam("toWrap", toWrap); KeyStore keyStore = new UnmodifiableKeyStore(new UnmodifiableKeyStoreSpi(toWrap), toWrap.getProvider(), toWrap.getType()); keyStore.load(null, null); return keyStore; } }