package at.gv.egovernment.moa.spss.server.iaik.pki;
import iaik.pki.PKIProfile;
import iaik.pki.pathvalidation.ValidationProfile;
import iaik.pki.revocation.RevocationProfile;
import iaik.pki.store.truststore.TrustStoreProfile;
import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.iaik.pki.pathvalidation.ValidationProfileImpl;
import at.gv.egovernment.moa.spss.server.iaik.pki.revocation.RevocationProfileImpl;
import at.gv.egovernment.moa.spss.server.iaik.pki.store.truststore.TrustStoreProfileImpl;
/**
* Implementation of the PKIProfile
interface containing
* information needed for certificate path validation. It uses configuration
* data from the MOA configuration.
*
* @author Patrick Peck
* @version $Id$
*/
public class PKIProfileImpl implements PKIProfile {
/** Profile information for revocation checking. */
private RevocationProfile revocationProfile;
/** Profile information about the trust profile to use. */
private TrustStoreProfile trustStoreProfile;
/** Profile information about the certificate validation. */
private ValidationProfile validationProfile;
/** The ConfigurationProvider
to read the MOA configuration data
* from. */
private ConfigurationProvider config;
/**
* Create a new PKIProfileImpl
.
*
* @param config The MOA configuration providing configuration data about
* certificate path validation.
* @param trustProfileID The trust profile ID denoting the location of the
* trust store.
* @throws MOAApplicationException An error occurred building the profile.
*/
public PKIProfileImpl(ConfigurationProvider config, String trustProfileID)
throws MOAApplicationException {
this.config = config;
setRevocationProfile(new RevocationProfileImpl(config));
setTrustStoreProfile(new TrustStoreProfileImpl(config, trustProfileID));
setValidationProfile(new ValidationProfileImpl(config));
}
/**
* @see iaik.pki.PKIProfile#autoAddCertificates()
*/
public boolean autoAddCertificates()
{
return useAuthorityInfoAccess() ? true : config.getAutoAddCertificates();
}
/**
* @see iaik.pki.PKIProfile#getRevocationProfile()
*/
public RevocationProfile getRevocationProfile() {
return revocationProfile;
}
/**
* Sets the RevocationProfile
.
*
* @param revocationProfile The RevocationProfile
used for
* revocation checking.
*/
protected void setRevocationProfile(RevocationProfile revocationProfile) {
this.revocationProfile = revocationProfile;
}
/**
* @see iaik.pki.PKIProfile#getTrustStoreProfile()
*/
public TrustStoreProfile getTrustStoreProfile() {
return trustStoreProfile;
}
/**
* Sets the TrustStoreProfile
.
*
* @param trustStoreProfile The TrustStoreProfile
.
*/
protected void setTrustStoreProfile(TrustStoreProfile trustStoreProfile) {
this.trustStoreProfile = trustStoreProfile;
}
/**
* @see iaik.pki.PKIProfile#getValidationProfile()
*/
public ValidationProfile getValidationProfile() {
return validationProfile;
}
/**
* Sets the ValidationProfile
.
*
* @param validationProfile The ValidationProfile
to set.
*/
protected void setValidationProfile(ValidationProfile validationProfile) {
this.validationProfile = validationProfile;
}
/**
* @see iaik.pki.PKIProfile#useAuthorityInfoAccess()
*/
public boolean useAuthorityInfoAccess()
{
return config.getUseAuthorityInfoAccess();
}
}