@Override public void createAndStoreEncryptionKeyForCluster(String clusterName, String alias) { try { as.generateAliasForCluster(clusterName, alias); } catch (AliasServiceException e) { e.printStackTrace(); } }
@Override public void removeAliasForCluster(String clusterName, String alias) throws AliasServiceException { try { keystoreService.removeCredentialForCluster(clusterName, alias); } catch (KeystoreServiceException e) { throw new AliasServiceException(e); } }
@Override public Certificate getCertificateForGateway(final String alias) throws AliasServiceException { /* We don't store certs in remote registry so we just delegate certs to keystore (DefaultAliasService.getCertificateForGateway) */ return localAliasService.getCertificateForGateway(alias); }
private char[] getSigningKeyPassphrase(char[] signingKeyPassphrase) throws AliasServiceException { if(signingKeyPassphrase != null) { return signingKeyPassphrase; } char[] phrase = as.getPasswordFromAliasForGateway(SIGNING_KEY_PASSPHRASE); if (phrase == null) { phrase = as.getGatewayIdentityPassphrase(); } return phrase; }
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; }
private String encode( String string ) throws UnsupportedEncodingException { EncryptionResult result = cryptoService.encryptForCluster(clusterName, EncryptUriDescriptor.PASSWORD_ALIAS, string.getBytes(StandardCharsets.UTF_8)); string = Base64.encodeBase64URLSafeString(result.toByteAray()); return string; }
private String decode( String string ) throws UnsupportedEncodingException { byte[] bytes = Base64.decodeBase64( string ); EncryptionResult result = EncryptionResult.fromByteArray(bytes); byte[] clear = cryptoService.decryptForCluster(clusterName, EncryptUriDescriptor.PASSWORD_ALIAS, result.cipher, result.iv, result.salt); if (clear != null) { return new String(clear, StandardCharsets.UTF_8); } return null; } }
@Override public void generateAliasForCluster(String clusterName, String alias) throws AliasServiceException { try { keystoreService.getCredentialStoreForCluster(clusterName); } catch (KeystoreServiceException e) { LOG.failedToGenerateAliasForCluster(clusterName, e); throw new AliasServiceException(e); } String passwordString = generatePassword(16); addAliasForCluster(clusterName, alias, passwordString); }
@Override public char[] getGatewayIdentityPassphrase() throws AliasServiceException { char[] passphrase = getPasswordFromAliasForGateway( GATEWAY_IDENTITY_PASSPHRASE); if (passphrase == null) { passphrase = ms.getMasterSecret(); } return passphrase; }
@Override public char[] getGatewayIdentityPassphrase() throws AliasServiceException { char[] passphrase = getPasswordFromAliasForGateway(GATEWAY_IDENTITY_PASSPHRASE); if (passphrase == null) { passphrase = masterService.getMasterSecret(); } return passphrase; }
/** * Add the alias to the local keystore. * Most likely this will be called by remote registry watch listener. * * @param clusterName Name of the cluster * @param alias Alias name to be added * @param value alias value to be added * @throws AliasServiceException exception on failure adding alias */ public void addAliasForClusterLocally(final String clusterName, final String alias, final String value) throws AliasServiceException { localAliasService.addAliasForCluster(clusterName, alias, value); }
@Override public void addAliasForCluster(String clusterName, String alias, String value) { try { keystoreService.addCredentialForCluster(clusterName, alias, value); } catch (KeystoreServiceException e) { LOG.failedToAddCredentialForCluster(clusterName, e); } }
private char[] getSigningKeyPassphrase(char[] signingKeyPassphrase) throws AliasServiceException { if(signingKeyPassphrase != null) { return signingKeyPassphrase; } char[] phrase = as.getPasswordFromAliasForGateway(SIGNING_KEY_PASSPHRASE); if (phrase == null) { phrase = as.getGatewayIdentityPassphrase(); } return phrase; }
@Override public void generateAliasForCluster(String clusterName, String alias) throws AliasServiceException { try { keystoreService.getCredentialStoreForCluster(clusterName); } catch (KeystoreServiceException e) { LOG.failedToGenerateAliasForCluster(clusterName, e); throw new AliasServiceException(e); } String passwordString = generatePassword(16); addAliasForCluster(clusterName, alias, passwordString); }
@Override public char[] getGatewayIdentityPassphrase() throws AliasServiceException { char[] passphrase = getPasswordFromAliasForGateway( GATEWAY_IDENTITY_PASSPHRASE); if (passphrase == null) { passphrase = ms.getMasterSecret(); } return passphrase; }
@Override public char[] getGatewayIdentityPassphrase() throws AliasServiceException { char[] passphrase = getPasswordFromAliasForGateway(GATEWAY_IDENTITY_PASSPHRASE); if (passphrase == null) { passphrase = masterService.getMasterSecret(); } return passphrase; }
@Override public void createAndStoreEncryptionKeyForCluster(String clusterName, String alias) { try { as.generateAliasForCluster(clusterName, alias); } catch (AliasServiceException e) { e.printStackTrace(); } }
@Override public void removeAliasForCluster(String clusterName, String alias) throws AliasServiceException { try { keystoreService.removeCredentialForCluster(clusterName, alias); } catch (KeystoreServiceException e) { throw new AliasServiceException(e); } }
/** * Add the alias to the local keystore. * Most likely this will be called by remote registry watch listener. * * @param clusterName Name of the cluster * @param alias Alias name to be added * @param value alias value to be added * @throws AliasServiceException exception on failure adding alias */ public void addAliasForClusterLocally(final String clusterName, final String alias, final String value) throws AliasServiceException { localAliasService.addAliasForCluster(clusterName, alias, value); }
@Override public Certificate getCertificateForGateway(final String alias) throws AliasServiceException { /* We don't store certs in remote registry so we just delegate certs to keystore (DefaultAliasService.getCertificateForGateway) */ return localAliasService.getCertificateForGateway(alias); }