File size: 1,559 Bytes
67204ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
import java.io.IOException;
/**
* The Class CustomDataSource.
*/
public class CustomDataSource extends org.apache.tomcat.jdbc.pool.DataSource {
/**
* Sets the password.
*
* @param encodedPassword the new password
*/
public synchronized void setPassword(String encodedPassword) {
this.poolProperties.setPassword(AESUtils.decrypt(encodedPassword));
}
/**
* Sets the username.
*
* @param encodedUsername the new username
*/
public synchronized void setUsername(String encodedUsername) {
this.poolProperties.setUsername(AESUtils.decrypt(encodedUsername));
}
/**
* Sets the url.
*
* @param encodedUrl the new url
*/
public synchronized void setUrl(String encodedUrl) {
this.poolProperties.setUrl(AESUtils.decrypt(encodedUrl));
}
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String args[]) throws IOException {
//System.out.println(args.length);
if (args.length < 2)
{
System.out.println("ArrayIndexOutOfBoundsException: 1, For Encrypt use command (sh encodeco.sh e '<input>') | For Decrypt use command (sh encodeco.sh d '<input>') | Note: Input must be in single quote" );
}
else if (args[0].toString().equals("e"))
{
System.out.println("Encrypted One");
System.out.println(AESUtils.encrypt(args[1].toString()));
}
else if (args[0].toString().equals("d"))
{
System.out.println("Decrypted One");
System.out.println(AESUtils.decrypt(args[1].toString()));
}
}
}
|