public boolean isKeystoreAvailable() throws KeystoreServiceException { final File keyStoreFile = new File( keyStoreDir + serviceName + ".jks" ); try { return isKeystoreAvailable(keyStoreFile, "JKS"); } catch (KeyStoreException | IOException e) { throw new KeystoreServiceException(e); } }
public boolean isKeystoreAvailable() throws KeystoreServiceException { final File keyStoreFile = new File( keyStoreDir + serviceName + ".jks" ); try { return isKeystoreAvailable(keyStoreFile, "JKS"); } catch (KeyStoreException | IOException e) { throw new KeystoreServiceException(e); } }
public boolean isCredentialStoreAvailable() throws KeystoreServiceException { final File keyStoreFile = new File( keyStoreDir + serviceName + CREDENTIALS_SUFFIX ); try { return isKeystoreAvailable(keyStoreFile, "JCEKS"); } catch (KeyStoreException | IOException e) { throw new KeystoreServiceException(e); } }
public boolean isCredentialStoreAvailable() throws KeystoreServiceException { final File keyStoreFile = new File( keyStoreDir + serviceName + CREDENTIALS_SUFFIX ); try { return isKeystoreAvailable(keyStoreFile, "JCEKS"); } catch (KeyStoreException | IOException e) { throw new KeystoreServiceException(e); } }
@Override public boolean isCredentialStoreForClusterAvailable(String clusterName) throws KeystoreServiceException { boolean rc = false; final File keyStoreFile = new File( keyStoreDir + clusterName + CREDENTIALS_SUFFIX ); readLock.lock(); try { try { rc = isKeystoreAvailable(keyStoreFile, "JCEKS"); } catch (KeyStoreException e) { throw new KeystoreServiceException(e); } catch (IOException e) { throw new KeystoreServiceException(e); } return rc; } finally { readLock.unlock(); } }
@Override public boolean isKeystoreForGatewayAvailable() throws KeystoreServiceException { boolean rc = false; final File keyStoreFile = new File( keyStoreDir + GATEWAY_KEYSTORE ); readLock.lock(); try { try { rc = isKeystoreAvailable(keyStoreFile, "JKS"); } catch (KeyStoreException e) { throw new KeystoreServiceException(e); } catch (IOException e) { throw new KeystoreServiceException(e); } return rc; } finally { readLock.unlock(); } }
@Override public boolean isKeystoreForGatewayAvailable() throws KeystoreServiceException { boolean rc; final File keyStoreFile = new File( keyStoreDir + GATEWAY_KEYSTORE ); readLock.lock(); try { try { rc = isKeystoreAvailable(keyStoreFile, "JKS"); } catch (KeyStoreException | IOException e) { throw new KeystoreServiceException(e); } return rc; } finally { readLock.unlock(); } }
@Override public boolean isCredentialStoreForClusterAvailable(String clusterName) throws KeystoreServiceException { boolean rc; final File keyStoreFile = new File( keyStoreDir + clusterName + CREDENTIALS_SUFFIX ); readLock.lock(); try { try { rc = isKeystoreAvailable(keyStoreFile, "JCEKS"); } catch (KeyStoreException | IOException e) { throw new KeystoreServiceException(e); } return rc; } finally { readLock.unlock(); } }
@Override public KeyStore getSigningKeystore(String keystoreName) throws KeystoreServiceException { File keyStoreFile; if(keystoreName != null) { keyStoreFile = new File(keyStoreDir + keystoreName + ".jks"); } else if (signingKeystoreName != null) { keyStoreFile = new File(keyStoreDir + signingKeystoreName); } else { keyStoreFile = new File(keyStoreDir + GATEWAY_KEYSTORE); } // make sure the keystore exists if (!keyStoreFile.exists()) { throw new KeystoreServiceException("Configured signing keystore does not exist."); } readLock.lock(); try { return getKeystore(keyStoreFile, "JKS"); } finally { readLock.unlock(); } }
@Override public KeyStore getSigningKeystore(String keystoreName) throws KeystoreServiceException { File keyStoreFile; if(keystoreName != null) { keyStoreFile = new File(keyStoreDir + keystoreName + ".jks"); } else if (signingKeystoreName != null) { keyStoreFile = new File(keyStoreDir + signingKeystoreName); } else { keyStoreFile = new File(keyStoreDir + GATEWAY_KEYSTORE); } // make sure the keystore exists if (!keyStoreFile.exists()) { throw new KeystoreServiceException("Configured signing keystore does not exist."); } readLock.lock(); try { return getKeystore(keyStoreFile, "JKS"); } finally { readLock.unlock(); } }
protected KeyStore getKeystore(final File keyStoreFile, String storeType) throws KeystoreServiceException { KeyStore credStore = null; try { credStore = loadKeyStore( keyStoreFile, masterService.getMasterSecret(), storeType); } catch (CertificateException e) { LOG.failedToLoadKeystore( keyStoreFile.getName(), storeType, e ); throw new KeystoreServiceException(e); } catch (KeyStoreException e) { LOG.failedToLoadKeystore( keyStoreFile.getName(), storeType, e ); throw new KeystoreServiceException(e); } catch (NoSuchAlgorithmException e) { LOG.failedToLoadKeystore( keyStoreFile.getName(), storeType, e ); throw new KeystoreServiceException(e); } catch (IOException e) { LOG.failedToLoadKeystore( keyStoreFile.getName(), storeType, e ); throw new KeystoreServiceException(e); } return credStore; }
protected void createKeystore(String filename, String keystoreType) throws KeystoreServiceException { try (OutputStream out = createKeyStoreFile( filename )) { KeyStore ks = KeyStore.getInstance(keystoreType); ks.load( null, null ); ks.store( out, masterService.getMasterSecret() ); } catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) { LOG.failedToCreateKeystore( filename, keystoreType, e ); throw new KeystoreServiceException(e); } }
protected void createKeystore(String filename, String keystoreType) throws KeystoreServiceException { try { FileOutputStream out = createKeyStoreFile( filename ); KeyStore ks = KeyStore.getInstance(keystoreType); ks.load( null, null ); ks.store( out, masterService.getMasterSecret() ); out.close(); } catch (KeyStoreException e) { LOG.failedToCreateKeystore( filename, keystoreType, e ); throw new KeystoreServiceException(e); } catch (NoSuchAlgorithmException e) { LOG.failedToCreateKeystore( filename, keystoreType, e ); throw new KeystoreServiceException(e); } catch (CertificateException e) { LOG.failedToCreateKeystore( filename, keystoreType, e ); throw new KeystoreServiceException(e); } catch (FileNotFoundException e) { LOG.failedToCreateKeystore( filename, keystoreType, e ); throw new KeystoreServiceException(e); } catch (IOException e) { LOG.failedToCreateKeystore( filename, keystoreType, e ); throw new KeystoreServiceException(e); } }
protected KeyStore getKeystore(final File keyStoreFile, String storeType) throws KeystoreServiceException { KeyStore credStore; try { credStore = loadKeyStore( keyStoreFile, masterService.getMasterSecret(), storeType); } catch (CertificateException | IOException | NoSuchAlgorithmException | KeyStoreException e) { LOG.failedToLoadKeystore( keyStoreFile.getName(), storeType, e ); throw new KeystoreServiceException(e); } return credStore; }
throw new KeystoreServiceException(e);