日期:2014-05-20  浏览次数:20735 次

算法问题:这段程序如何加密的?
//有无办法写个算号器?
public   class   ASTPrimaryCheck
{

private   static   final   String   DT   =   "dt ";
private   static   final   String   PK   =   "pk ";
private   static   final   String   USER   =   "us ";
private   static   final   String   TRY_LABEL   =   "Try   FDT ";
private   static   final   String   EXPIRED_LABEL   =   "Use   Restricted ";
private   static   boolean   valid   =   true;
private   static   boolean   checked   =   false;

public   ASTPrimaryCheck()
{
}

public   static   void   check()
{
if   (checked)
return;
checked   =   true;
if   (hasSerial())
{
checkSerial();
return;
}
String   pd   =   FDTUIPlugin.getPluginDirectory();
File   f   =   new   File((new   StringBuilder(String.valueOf(pd))).append( "icons/imageIndexByte ").toString());
boolean   hasDate   =   hasInstallDate();
if   (!f.exists()   &&   !hasDate)
{
valid   =   false;
openDialog(getTimeUpText(),   "Use   Restricted ");
return;
}
if   (f.exists())
f.delete();
long   installDate   =   -1L;
if   (hasDate)
installDate   =   getInstallDate();
else
installDate   =   createInstallData();
if   (installDate   ==   -1L)
{
valid   =   false;
openDialog(getTimeUpText(),   "Use   Restricted ");
return;
}
long   currentDate   =   System.currentTimeMillis();
long   diff   =   currentDate   -   installDate;
long   diffDay   =   diff   /   1000L   /   60L   /   60L   /   24L;
long   daysLeft   =   30L   -   diffDay;
if   (daysLeft   >   30L   ||   installDate   ==   -2L   ||   daysLeft   <=   0L)
{
ConfigurationSupport.storeObject( "dt ",   new   Long(-2L));
valid   =   false;
openDialog(getTimeUpText(),   "Use   Restricted ");
}   else
{
openDialog(getTimeLeftText(daysLeft),   "Try   FDT ");
}
}

public   static   boolean   isValid()
{
return   valid;
}

public   static   boolean   storeKey(String   userName,   String   key)
{
if   (!ConfigurationSupport.storeObject( "us ",   userName))
return   false;
if   (!ConfigurationSupport.storeObject( "pk ",   key))
{
return   false;
}   else
{
valid   =   true;
return   true;
}
}

private   static   boolean   hasSerial()
{
return   ConfigurationSupport.hasObject( "us ")   &&   ConfigurationSupport.hasObject( "pk ");
}

private   static   void   checkSerial()
{
try
{
String   key   =   (String)ConfigurationSupport.readObject( "pk ");