Public static final string passwrods = "2222222 ";
Private keygenerator keygen; // provides key generator functions and supports various algorithms.
Private secretkey secret ey; // secretkey stores symmetric keys
Private cipher c; // responsible for encryption or decryption
Public ftputil (){
// Todo auto-generated constructor stub
Ftpclient = new ftpclient ();
Try {
Keygen = keygenerator. getinstance ("des ");
Required ey = keygen. generatekey ();
C = cipher. getinstance ("des ");
} Catch (nosuchalgorithmexception e ){
// Todo auto-generated Catch Block
E. printstacktrace ();
} Catch (nosuchpaddingexception e ){
// Todo auto-generated Catch Block
E. printstacktrace ();
}
}
// Decrypt despassword and compare it with the original password
Public Boolean parsedes (string orpassword, string despasswrod) throws invalidkeyexception, illegalblocksizeexception, badpaddingexception {
Boolean isright = false;
C. INIT (Cipher. decrypt_mode, cipher ey );
Byte [] passwroidchars = C. dofinal (despasswrod. getbytes ());
String dectypt = new string (passwroidchars );
Isright = orpassword. Equals (dectypt );
Return isright;
}