@Test public void encryptUriPassword_shouldEncryptCredentials() throws Exception { String encrypted = AESEncryption.encryptUriPassword(DECRYPTED_URI); assertEquals(ENCRYPTED_URI, encrypted); }
public static String encryptUriPassword(final String rawUri) throws GeneralSecurityException { try { URI uri = new URI(rawUri); UserInfo userInfo = extractCredentials(uri); if (userInfo != null && userInfo.password != null) { userInfo.password = encrypt(userInfo.password); return setCredentials(uri, userInfo).toString(); } else { return rawUri; } } catch (URISyntaxException e) { throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e); } }
AESEncryption { public static String encryptUriPassword(final String rawUri) throws GeneralSecurityException { try { URI uri = new URI(rawUri); UserInfo userInfo = extractCredentials(uri); if (userInfo != null && userInfo.password != null) { userInfo.password = encrypt(userInfo.password); return setCredentials(uri, userInfo).toString(); } else { return rawUri; } } catch (URISyntaxException e) { throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e); } } }
AESEncryption { public static String encryptUriPassword(final String rawUri) throws GeneralSecurityException { try { URI uri = new URI(rawUri); UserInfo userInfo = extractCredentials(uri); if (userInfo != null && userInfo.password != null) { userInfo.password = encrypt(userInfo.password); return setCredentials(uri, userInfo).toString(); } else { return rawUri; } } catch (URISyntaxException e) { throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e); } } private  AESEncryption(); }
AESEncryption { public static String encryptUriPassword(final String rawUri) throws GeneralSecurityException { try { URI uri = new URI(rawUri); UserInfo userInfo = extractCredentials(uri); if (userInfo != null && userInfo.password != null) { userInfo.password = encrypt(userInfo.password); return setCredentials(uri, userInfo).toString(); } else { return rawUri; } } catch (URISyntaxException e) { throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e); } } private  AESEncryption(); static String encrypt(final String src); static String decrypt(final String src); static String decryptUriPassword(final String rawUri); static String encryptUriPassword(final String rawUri); static String decrypt(final String name, final String src); }
AESEncryption { public static String encryptUriPassword(final String rawUri) throws GeneralSecurityException { try { URI uri = new URI(rawUri); UserInfo userInfo = extractCredentials(uri); if (userInfo != null && userInfo.password != null) { userInfo.password = encrypt(userInfo.password); return setCredentials(uri, userInfo).toString(); } else { return rawUri; } } catch (URISyntaxException e) { throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e); } } private  AESEncryption(); static String encrypt(final String src); static String decrypt(final String src); static String decryptUriPassword(final String rawUri); static String encryptUriPassword(final String rawUri); static String decrypt(final String name, final String src);  }