private String encryptPassword(String plainTextPassword) throws CryptoException { if (plainTextPassword != null) { return CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(plainTextPassword.getBytes()); } return null; }
private String encrypt(String plainText) throws CryptoException { return CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode( plainText.getBytes(Charsets.UTF_8)); }
private String encrypt(String plainText) throws CryptoException { return CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode( plainText.getBytes(Charsets.UTF_8)); }
private String getEncryptedPassword(String password) throws SecurityConfigException { CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); try { return cryptoUtil.encryptAndBase64Encode(password.getBytes()); } catch (CryptoException e) { String msg = "Unable to encrypt and encode password string."; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
private String getEncryptedPassword(String password) throws SecurityConfigException { CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); try { return cryptoUtil.encryptAndBase64Encode(password.getBytes()); } catch (CryptoException e) { String msg = "Unable to encrypt and encode password string."; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
private String getEncryptedPassword(String password) throws SecurityConfigException { CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); try { return cryptoUtil.encryptAndBase64Encode(password.getBytes()); } catch (CryptoException e) { String msg = "Unable to encrypt and encode password string."; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
if (isUsernameEncryptionEnabled) { encryptedAndBase64EncodedUsername = CryptoUtil.getDefaultCryptoUtil(). encryptAndBase64Encode(username.getBytes()); } else { return username;
private void encodeProperty(Resource resource, String propKey) { try { if (resource.getProperty(propKey) != null) { resource.setProperty(propKey, CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode( resource.getProperty(propKey).getBytes())); } } catch (CryptoException e) { log.error("Unable to encrypt property key: " + propKey + " for resource " + "path: " + resource.getPath(), e); } }
if (isUsernameEncryptionEnabled) { encryptedAndBase64EncodedUsername = CryptoUtil.getDefaultCryptoUtil(). encryptAndBase64Encode(username.getBytes()); } else { return username;
if (isUsernameEncryptionEnabled) { encryptedAndBase64EncodedUsername = CryptoUtil.getDefaultCryptoUtil(). encryptAndBase64Encode(username.getBytes()); } else { return username;
/** * Encrypts the sensitive data in the Profile. * Currently encrypts only the passwords of the JMX * server and Data publisher. * * @param profile The profile which has the data to be encrypted * @return The profile with the encrypted data */ private Profile encryptData(Profile profile) throws CryptoException { //encrypt the JMX server password String password = profile.getPass(); //encrypt the password String cipherT = CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(password.getBytes()); profile.setPass(cipherT); //encrypt the data publisher password String dpPassword = profile.getDpPassword(); //encrypt the password String dpCipherT = CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(dpPassword.getBytes()); profile.setDpPassword(dpCipherT); return profile; }
/** * * @param token * @return */ public static String encryptToken(String token) throws CryptoException { AppManagerConfiguration config = ServiceReferenceHolder.getInstance() .getAPIManagerConfigurationService() .getAPIManagerConfiguration(); if (Boolean.parseBoolean(config.getFirstProperty(AppMConstants.API_KEY_MANAGER_ENCRYPT_TOKENS))) { return CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(token.getBytes()); } return token; }
try { String encryptedValue = CryptoUtil.getDefaultCryptoUtil(). encryptAndBase64Encode(dto.getValue().getBytes()); dto.setValue(encryptedValue); } catch (CryptoException e) {
try { String encryptedValue = CryptoUtil.getDefaultCryptoUtil(). encryptAndBase64Encode(dto.getValue().getBytes()); dto.setValue(encryptedValue); } catch (CryptoException e) {
try { String encryptedValue = CryptoUtil.getDefaultCryptoUtil(). encryptAndBase64Encode(dto.getValue().getBytes()); dto.setValue(encryptedValue); } catch (CryptoException e) {
public void addTrustStore(byte[] content, String filename, String password, String provider, String type) throws SecurityConfigException { if (filename == null) { throw new SecurityConfigException("Key Store name can't be null"); } try { if (KeyStoreUtil.isPrimaryStore(filename)) { throw new SecurityConfigException("Key store " + filename + " already available"); } String path = SecurityConstants.KEY_STORES + "/" + filename; if (registry.resourceExists(path)) { throw new SecurityConfigException("Key store " + filename + " already available"); } KeyStore keyStore = KeyStore.getInstance(type); keyStore.load(new ByteArrayInputStream(content), password.toCharArray()); CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); Resource resource = registry.newResource(); resource.addProperty(SecurityConstants.PROP_PASSWORD, cryptoUtil .encryptAndBase64Encode(password.getBytes())); resource.addProperty(SecurityConstants.PROP_PROVIDER, provider); resource.addProperty(SecurityConstants.PROP_TYPE, type); resource.setContent(content); registry.put(path, resource); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when adding a trustStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
public void addTrustStore(byte[] content, String filename, String password, String provider, String type) throws SecurityConfigException { if (filename == null) { throw new SecurityConfigException("Key Store name can't be null"); } try { if (KeyStoreUtil.isPrimaryStore(filename)) { throw new SecurityConfigException("Key store " + filename + " already available"); } String path = SecurityConstants.KEY_STORES + "/" + filename; if (registry.resourceExists(path)) { throw new SecurityConfigException("Key store " + filename + " already available"); } KeyStore keyStore = KeyStore.getInstance(type); keyStore.load(new ByteArrayInputStream(content), password.toCharArray()); CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); Resource resource = registry.newResource(); resource.addProperty(SecurityConstants.PROP_PASSWORD, cryptoUtil .encryptAndBase64Encode(password.getBytes())); resource.addProperty(SecurityConstants.PROP_PROVIDER, provider); resource.addProperty(SecurityConstants.PROP_TYPE, type); resource.setContent(content); registry.put(path, resource); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when adding a trustStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
public void addTrustStore(byte[] content, String filename, String password, String provider, String type) throws SecurityConfigException { if (filename == null) { throw new SecurityConfigException("Key Store name can't be null"); } try { if (KeyStoreUtil.isPrimaryStore(filename)) { throw new SecurityConfigException("Key store " + filename + " already available"); } String path = SecurityConstants.KEY_STORES + "/" + filename; if (registry.resourceExists(path)) { throw new SecurityConfigException("Key store " + filename + " already available"); } KeyStore keyStore = KeyStore.getInstance(type); keyStore.load(new ByteArrayInputStream(content), password.toCharArray()); CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil(); Resource resource = registry.newResource(); resource.addProperty(SecurityConstants.PROP_PASSWORD, cryptoUtil .encryptAndBase64Encode(password.getBytes())); resource.addProperty(SecurityConstants.PROP_PROVIDER, provider); resource.addProperty(SecurityConstants.PROP_TYPE, type); resource.setContent(content); registry.put(path, resource); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when adding a trustStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
if (content instanceof String) { resource.setContent( CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode( ((String) content).getBytes())); } else if (content instanceof byte[]) {
try { String cipherTextPassword = cryptoUtil. encryptAndBase64Encode(password.getBytes()); connectionResource.setProperty(PersistencyConstants.PASSWORD_PROPERTY, cipherTextPassword);