Please see
the code below. I am trying to
encrypt the Strings and then letting them pass. I am unable to get the
around thing
working. This is what I am using.
Main class:
public
class Details {
public void checkUsernamePassword(String
username, String password) {
System.out.println("Username
Encrypted : " + username);
System.out.println("Password
Encrypted : " + password);
}
public static void main(String[] args) {
String
username = "lipika";
String
password = "lipika";
System.out.println("Username
: " + username);
System.out.println("Password
: " + password);
Details
details = new Details();
details.checkUsernamePassword(username,
password);
}
}
Aspect
Class:
public
aspect DetailsAspect {
public final static String DES =
"DES";
public final static String UTF8 =
"UTF8";
public static final String PBE_WITH_MD5_AND_DES
= "PBEWithMD5AndDES";
private static byte[] salt = { (byte) 0xA9,
(byte) 0x9B, (byte) 0xC8,
(byte) 0x32,
(byte) 0x56, (byte) 0x35, (byte) 0xE3, (byte) 0x03 };
private static final int INTERACTION = 19;
public static String encrypt(String plain)
throws Exception {
…
}
public static String decrypt(String secret)
throws Exception {
…
}
before (Details d, String username, String
password) : target(d)
&& args(username, password)
&& call(public void
checkUsernamePassword(String, String)) {
try {
String
usernameEncrypted = encrypt(username);
String
passwordEncrypted = encrypt(password);
username
= usernameEncrypted;
password
= passwordEncrypted;
} catch
(Exception e) {
}
System.out.println("Encrypted
username: " + username);
System.out.println("Encrypted
password: " + password);
}
}
See the
Programming Guide, Semantics
appendix, section on (around) advice:
Look for
the example with
"proceed(i*2)"
------------Original
Message------------
Date: Sun,
Jan-8-2006 8:26 PM
Subject:
[aspectj-users] Sending back the
changed values
I am
intercepting just before a function
call. I am changing the parameter values that are being passed to the
function
using an aspect. I want that when the aspect finishes its job, the
changed
values should be passed on to the original java class, which can then
be
further used in the main program.
****************
CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Infosys has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the
content of all messages sent to or from this e-mail address. Messages
sent to or from this e-mail address may be stored on the Infosys e-mail
system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
|
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users