📄 updatepolicycrl.java
字号:
package SOMA.security.infrastructure.updatePolicy;
import java.util.Date;
import java.util.Calendar;
import java.io.PrintStream;
import iaik.x509.X509CRL;
import SOMA.security.infrastructure.Infrastructure;
public class UpdatePolicyCRL extends UpdatePolicy {
// Sleeping Time in milli second
// private long SleepTime = 60000;
protected Infrastructure infrastructure;
public PrintStream out;
public UpdatePolicyCRL ( String msg , Infrastructure infrastructure , PrintStream out )
{
super ( new String( msg ) );
this.infrastructure = infrastructure;
this.out = out;
}
public UpdatePolicyCRL ( Infrastructure infrastructure )
{
this( new String( "Update Policy CRL LifeTime" ) , infrastructure , System.out );
}
public UpdatePolicyCRL ( String msg , Infrastructure infrastructure )
{
this( new String( msg ), infrastructure , System.out );
}
public boolean update ()
{
try {
X509CRL[] crl = (infrastructure.getCertificateCRLList()).getCRLList();
//CertificateCRLList
Date crlUpDate = null;
if ( crl != null )
for ( int i=0 ; i<crl.length ; i++ )
if ( i == 0 ) crlUpDate = crl[i].getNextUpdate ();
else if ( 0 > crlUpDate.compareTo( crl[i].getNextUpdate () ) )
crlUpDate = crl[i].getNextUpdate();
Calendar rightNow = Calendar.getInstance();
return ( ( crlUpDate == null ) ||
( 0 > crlUpDate.compareTo( rightNow.getTime() ) ));
} catch ( Exception e ) { out.println(" Errore durante la valutazione delle date."); }
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -