package at.gv.egovernment.moa.spss.server.iaik.pki.revocation;
import java.security.cert.X509Certificate;
import iaik.pki.revocation.RevocationProfile;
import iaik.pki.revocation.RevocationSourceTypes;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
/**
* An implementation of the RevocationProfile
interface providing
* information about revocation status checking, based on MOA configuration
* data.
*
* @author Patrick Peck
* @version $Id$
*/
public class RevocationProfileImpl implements RevocationProfile {
/** The default service order. */
private static final String[] DEFAULT_SERVICE_ORDER =
{ RevocationSourceTypes.OCSP, RevocationSourceTypes.CRL };
/** The ConfigurationProvider
to read the MOA configuration data
* from. */
private ConfigurationProvider config;
/** The OCSP request hash algorithm. Currently only "SHA" is supported. */
private static final String oCSPRequestHashAlgorithm = "SHA";
/**
* Create a new RevocationProfileImpl
.
*
* @param config The MOA configuration data.
*/
public RevocationProfileImpl(ConfigurationProvider config) {
this.config = config;
// currently only "SHA" is supported
// this.oCSPRequestHashAlgorithm = "";
}
/**
* @see iaik.pki.revocation.RevocationProfile#getMaxRevocationAge(String)
*/
public long getMaxRevocationAge(String distributionPointUri)
{
return config.getMaxRevocationAge();
}
/**
* @see iaik.pki.revocation.RevocationProfile#getOCSPRequestHashAlgorithm()
*/
public String getOCSPRequestHashAlgorithm() {
return oCSPRequestHashAlgorithm;
}
/**
* @see iaik.pki.revocation.RevocationProfile#getPreferredServiceOrder(java.security.cert.X509Certificate)
*/
public String[] getPreferredServiceOrder(X509Certificate cert)
{
String[] serviceOrder = config.getServiceOrder();
if (serviceOrder == null || serviceOrder.length == 0) return DEFAULT_SERVICE_ORDER;
return serviceOrder;
}
}