package at.gv.egovernment.moa.id.iaik.pki;
import java.security.cert.X509Certificate;
import java.util.Collections;
import java.util.Set;
import iaik.pki.PKIProfile;
import iaik.pki.pathvalidation.ValidationProfile;
import iaik.pki.revocation.RevocationProfile;
import iaik.pki.revocation.RevocationSourceTypes;
import iaik.pki.store.truststore.TrustStoreProfile;
import iaik.pki.store.truststore.TrustStoreTypes;
import at.gv.egovernment.moa.id.iaik.servertools.observer.ObservableImpl;
/**
* Implementation of the PKIProfile
interface and subinterfaces
* providing information needed for certificate path validation.
*
* @author Paul Ivancsics
* @version $Id$
*/
public class PKIProfileImpl extends ObservableImpl
implements PKIProfile, RevocationProfile, TrustStoreProfile, ValidationProfile {
/**
* URI to the truststore
*/
private String trustStoreURI;
/**
* revocation checking;
*/
private boolean revocationChecking;
/**
* The trust profile identifier.
*/
private String id;
/**
* Create a new PKIProfileImpl
.
*
* @param trustStoreURI trust store URI
*/
public PKIProfileImpl(String trustStoreURI, boolean revocationChecking) {
this.trustStoreURI = trustStoreURI;
this.revocationChecking = revocationChecking;
String id = String.valueOf(System.currentTimeMillis());
setId("id-" + id);
}
/**
* @see iaik.pki.PKIProfile#autoAddCertificates()
*/
public boolean autoAddCertificates() {
return true;
}
/**
* @see iaik.pki.PKIProfile#getRevocationProfile()
*/
public RevocationProfile getRevocationProfile() {
return this;
}
/**
* @see iaik.pki.PKIProfile#getTrustStoreProfile()
*/
public TrustStoreProfile getTrustStoreProfile() {
return this;
}
/**
* @see iaik.pki.PKIProfile#getValidationProfile()
*/
public ValidationProfile getValidationProfile() {
return this;
}
/**
* @see iaik.pki.PKIProfile#useAuthorityInfoAccess()
*/
public boolean useAuthorityInfoAccess() {
return true;
}
/**
* @see iaik.pki.revocation.RevocationProfile#getMaxRevocationAge(java.lang.String)
*/
public long getMaxRevocationAge(String arg0) {
return 0;
}
/**
* @see iaik.pki.revocation.RevocationProfile#getOCSPRequestHashAlgorithm()
*/
public String getOCSPRequestHashAlgorithm() {
return null;
}
/**
* @see iaik.pki.revocation.RevocationProfile#getPreferredServiceOrder(java.security.cert.X509Certificate)
*/
public String[] getPreferredServiceOrder(X509Certificate arg0) {
return new String[] {RevocationSourceTypes.CRL};
}
/**
* @see iaik.pki.store.truststore.TrustStoreProfile#getType()
*/
public String getType() {
return TrustStoreTypes.DIRECTORY;
}
/**
* @see iaik.pki.store.truststore.TrustStoreProfile#getURI()
*/
public String getURI() {
return trustStoreURI;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialAnyPolicyInhibit()
*/
public boolean getInitialAnyPolicyInhibit() {
return false;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialExplicitPolicy()
*/
public boolean getInitialExplicitPolicy() {
return false;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialPolicyMappingInhibit()
*/
public boolean getInitialPolicyMappingInhibit() {
return false;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getInitialPolicySet()
*/
public Set getInitialPolicySet() {
return Collections.EMPTY_SET;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getNameConstraintsProcessing()
*/
public boolean getNameConstraintsProcessing() {
return false;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getPolicyProcessing()
*/
public boolean getPolicyProcessing() {
return false;
}
/**
* @see iaik.pki.pathvalidation.ValidationProfile#getRevocationChecking()
*/
public boolean getRevocationChecking() {
return this.revocationChecking;
}
/**
* @see iaik.pki.store.truststore.TrustStoreProfile#getId()
*/
public String getId() {
return id;
}
/**
* Sets the trust profile identifier.
* @param id The id to set.
*/
public void setId(String id) {
this.id = id;
}
}