Saturday, August 14, 2010

My Agent Security Scenario: The Code -Father & Global Class

//the folder Sec is sub folder at examples folder
//I created to place my java classes in
package examples.Sec;
//java class its memebers can be used by the Encrypt
//and Decrypt Aglets
public class Global
    //arrray of characters to save the username and password in it 
 //before calling the ncrypt or decrypt method
 public static char array_char[];
 //at encrypt or decrypt method the character at
 //array of characters need to be casted into ASCII 
 //value and stored at array of integers to encounter
 //an arithmetic operation then the resulted value represent 
 //an ASCII code ,which will be casted to char and stored into
 //the array of characters 
 public static int array_int[];
 public static String array_in_string()
     //this method store the content 
  //of the array of characters into
  String theString=new String();
  for(int d=0;d < Global.array_char.length;d++)
      //concatenation between the string content and 
   //the current char
  //theString may be the username in encrypted or clear text manner
  //thestring may be the password in encrypted or clear text manner
  return theString;

This class represents the first trigger in the system 
,that instatiating  "Encrypt" aglet providing input for "Decrypt"
package examples.Sec;
public class Father extends Aglet
 //AgletProxy help to handle the Aglet 
 //that will be created by the Father Aglet
 //I defined as static and public data members since 
 //I need to use  decryptProxy to at the Encrypt Aglet 
 //to send Messge to Decrypt Aglet
 public static AgletProxy encryptProxy;
 public static AgletProxy decryptProxy;
 public void onCreation(Object init)
      //create the Encrypt and Decrypt Aglet
   dispose();//kill the current Aglet
  }//end try block
  catch(Exception e)
  }//end catch block
 }//end on Creation method that called only when 
 //the aglet created 

No comments:

Post a Comment