Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.x509;
  
  
 import java.util.List;
 import java.util.Set;

This class extends the PKIXParameters with a validity model parameter.

Deprecated:
use PKIXExtendedParameters
 
 public class ExtendedPKIXParameters
     extends PKIXParameters
 {
 
     private List stores;
 
     private Selector selector;
 
     private boolean additionalLocationsEnabled;
 
     private List additionalStores;
 
     private Set trustedACIssuers;
 
     private Set necessaryACAttributes;
 
     private Set prohibitedACAttributes;
 
     private Set attrCertCheckers;

    
Creates an instance of PKIXParameters with the specified Set of most-trusted CAs. Each element of the set is a TrustAnchor.

Note that the Set is copied to protect against subsequent modifications.

Parameters:
trustAnchors a Set of TrustAnchors
Throws:
java.security.InvalidAlgorithmParameterException if the specified Set is empty.
java.lang.NullPointerException if the specified Set is null
java.lang.ClassCastException if any of the elements in the Set is not of type java.security.cert.TrustAnchor
 
     public ExtendedPKIXParameters(Set trustAnchors)
         throws InvalidAlgorithmParameterException
     {
         super(trustAnchors);
          = new ArrayList();
          = new ArrayList();
          = new HashSet();
          = new HashSet();
          = new HashSet();
          = new HashSet();
     }

    
Returns an instance with the parameters of a given PKIXParameters object.

Parameters:
pkixParams The given PKIXParameters
Returns:
an extended PKIX params object
 
     public static ExtendedPKIXParameters getInstance(PKIXParameters pkixParams)
     {
         ExtendedPKIXParameters params;
         try
         {
             params = new ExtendedPKIXParameters(pkixParams.getTrustAnchors());
         }
         catch (Exception e)
         {
             // cannot happen
             throw new RuntimeException(e.getMessage());
         }
         params.setParams(pkixParams);
         return params;
     }

    
Method to support clone() under J2ME. super.clone() does not exist and fields are not copied.

Parameters:
params Parameters to set. If this are ExtendedPKIXParameters they are copied to.
    protected void setParams(PKIXParameters params)
    {
        setDate(params.getDate());
        setCertPathCheckers(params.getCertPathCheckers());
        setCertStores(params.getCertStores());
        setRevocationEnabled(params.isRevocationEnabled());
        setInitialPolicies(params.getInitialPolicies());
        setSigProvider(params.getSigProvider());
        try
        {
            setTrustAnchors(params.getTrustAnchors());
        }
        catch (Exception e)
        {
            // cannot happen
            throw new RuntimeException(e.getMessage());
        }
        if (params instanceof ExtendedPKIXParameters)
        {
            ExtendedPKIXParameters _params = (ExtendedPKIXParametersparams;
             = _params.validityModel;
             = _params.useDeltas;
             = _params.additionalLocationsEnabled;
             = _params.selector == null ? null
                : (Selector_params.selector.clone();
             = new ArrayList(_params.stores);
             = new ArrayList(_params.additionalStores);
             = new HashSet(_params.trustedACIssuers);
             = new HashSet(_params.prohibitedACAttributes);
             = new HashSet(_params.necessaryACAttributes);
             = new HashSet(_params.attrCertCheckers);
        }
    }

    
This is the default PKIX validity model. Actually there are two variants of this: The PKIX model and the modified PKIX model. The PKIX model verifies that all involved certificates must have been valid at the current time. The modified PKIX model verifies that all involved certificates were valid at the signing time. Both are indirectly choosen with the java.security.cert.PKIXParameters.setDate(java.util.Date) method, so this methods sets the Date when all certificates must have been valid.
    public static final int PKIX_VALIDITY_MODEL = 0;

    
This model uses the following validity model. Each certificate must have been valid at the moment where is was used. That means the end certificate must have been valid at the time the signature was done. The CA certificate which signed the end certificate must have been valid, when the end certificate was signed. The CA (or Root CA) certificate must have been valid, when the CA certificate was signed and so on. So the java.security.cert.PKIXParameters.setDate(java.util.Date) method sets the time, when the end certificate must have been valid.

It is used e.g. in the German signature law.

    public static final int CHAIN_VALIDITY_MODEL = 1;
    private int validityModel = ;
    private boolean useDeltas = false;

    
Defaults to false.

Returns:
Returns if delta CRLs should be used.
    public boolean isUseDeltasEnabled()
    {
        return ;
    }

    
Sets if delta CRLs should be used for checking the revocation status.

Parameters:
useDeltas true if delta CRLs should be used.
    public void setUseDeltasEnabled(boolean useDeltas)
    {
        this. = useDeltas;
    }

    

Returns:
Returns the validity model.
See also:
CHAIN_VALIDITY_MODEL
PKIX_VALIDITY_MODEL
    public int getValidityModel()
    {
        return ;
    }

    
Sets the Java CertStore to this extended PKIX parameters.

Throws:
java.lang.ClassCastException if an element of stores is not a CertStore.
    public void setCertStores(List stores)
    {
        if (stores != null)
        {
            Iterator it = stores.iterator();
            while (it.hasNext())
            {
                addCertStore((CertStore)it.next());
            }
        }
    }

    
Sets the Bouncy Castle Stores for finding CRLs, certificates, attribute certificates or cross certificates.

The List is cloned.

Parameters:
stores A list of stores to use.
Throws:
java.lang.ClassCastException if an element of stores is not a org.bouncycastle.util.Store.
See also:
getStores()
    public void setStores(List stores)
    {
        if (stores == null)
        {
            this. = new ArrayList();
        }
        else
        {
            for (Iterator i = stores.iterator(); i.hasNext();)
            {
                if (!(i.next() instanceof Store))
                {
                    throw new ClassCastException(
                        "All elements of list must be "
                            + "of type org.bouncycastle.util.Store.");
                }
            }
            this. = new ArrayList(stores);
        }
    }

    
Adds a Bouncy Castle org.bouncycastle.util.Store to find CRLs, certificates, attribute certificates or cross certificates.

This method should be used to add local stores, like collection based X.509 stores, if available. Local stores should be considered first, before trying to use additional (remote) locations, because they do not need possible additional network traffic.

If store is null it is ignored.

Parameters:
store The store to add.
See also:
getStores()
    public void addStore(Store store)
    {
        if (store != null)
        {
            .add(store);
        }
    }

    
Adds an additional Bouncy Castle org.bouncycastle.util.Store to find CRLs, certificates, attribute certificates or cross certificates.

You should not use this method. This method is used for adding additional X.509 stores, which are used to add (remote) locations, e.g. LDAP, found during X.509 object processing, e.g. in certificates or CRLs. This method is used in PKIX certification path processing.

If store is null it is ignored.

Parameters:
store The store to add.
See also:
getStores()
Deprectaed:
use addStore().
    public void addAdditionalStore(Store store)
    {
        if (store != null)
        {
            .add(store);
        }
    }

    

Deprecated:
    public void addAddionalStore(Store store)
    {
        addAdditionalStore(store);      
    }

    
Returns an immutable List of additional Bouncy Castle Stores used for finding CRLs, certificates, attribute certificates or cross certificates.

Returns:
an immutable List of additional Bouncy Castle Stores. Never null.
See also:
addAdditionalStore(org.bouncycastle.util.Store)
    public List getAdditionalStores()
    {
        return Collections.unmodifiableList();
    }

    
Returns an immutable List of Bouncy Castle Stores used for finding CRLs, certificates, attribute certificates or cross certificates.

Returns:
an immutable List of Bouncy Castle Stores. Never null.
See also:
setStores(java.util.List)
    public List getStores()
    {
        return Collections.unmodifiableList(new ArrayList());
    }

    

Parameters:
validityModel The validity model to set.
See also:
CHAIN_VALIDITY_MODEL
PKIX_VALIDITY_MODEL
    public void setValidityModel(int validityModel)
    {
        this. = validityModel;
    }
    public Object clone()
    {
        ExtendedPKIXParameters params;
        try
        {
            params = new ExtendedPKIXParameters(getTrustAnchors());
        }
        catch (Exception e)
        {
            // cannot happen
            throw new RuntimeException(e.getMessage());
        }
        params.setParams(this);
        return params;
    }

    
Returns if additional X509Stores for locations like LDAP found in certificates or CRLs should be used.

Returns:
Returns true if additional stores are used.
    public boolean isAdditionalLocationsEnabled()
    {
        return ;
    }

    
Sets if additional X509Stores for locations like LDAP found in certificates or CRLs should be used.

Parameters:
enabled true if additional stores are used.
    public void setAdditionalLocationsEnabled(boolean enabled)
    {
         = enabled;
    }

    
Returns the required constraints on the target certificate or attribute certificate. The constraints are returned as an instance of Selector. If null, no constraints are defined.

The target certificate in a PKIX path may be a certificate or an attribute certificate.

Note that the Selector returned is cloned to protect against subsequent modifications.

Returns:
a Selector specifying the constraints on the target certificate or attribute certificate (or null)
See also:
setTargetConstraints(org.bouncycastle.util.Selector)
X509CertStoreSelector
X509AttributeCertStoreSelector
    {
        if ( != null)
        {
            return (Selector.clone();
        }
        else
        {
            return null;
        }
    }

    
Sets the required constraints on the target certificate or attribute certificate. The constraints are specified as an instance of Selector. If null, no constraints are defined.

The target certificate in a PKIX path may be a certificate or an attribute certificate.

Note that the Selector specified is cloned to protect against subsequent modifications.

Parameters:
selector a Selector specifying the constraints on the target certificate or attribute certificate (or null)
See also:
getTargetConstraints()
X509CertStoreSelector
X509AttributeCertStoreSelector
    public void setTargetConstraints(Selector selector)
    {
        if (selector != null)
        {
            this. = (Selectorselector.clone();
        }
        else
        {
            this. = null;
        }
    }

    
Sets the required constraints on the target certificate. The constraints are specified as an instance of X509CertSelector. If null, no constraints are defined.

This method wraps the given X509CertSelector into a X509CertStoreSelector.

Note that the X509CertSelector specified is cloned to protect against subsequent modifications.

Parameters:
selector a X509CertSelector specifying the constraints on the target certificate (or null)
See also:
java.security.cert.PKIXParameters.getTargetCertConstraints()
X509CertStoreSelector
    public void setTargetCertConstraints(CertSelector selector)
    {
        super.setTargetCertConstraints(selector);
        if (selector != null)
        {
            this. = X509CertStoreSelector
                .getInstance((X509CertSelectorselector);
        }
        else
        {
            this. = null;
        }
    }

    
Returns the trusted attribute certificate issuers. If attribute certificates is verified the trusted AC issuers must be set.

The returned Set consists of TrustAnchors.

The returned Set is immutable. Never null

Returns:
Returns an immutable set of the trusted AC issuers.
    public Set getTrustedACIssuers()
    {
        return Collections.unmodifiableSet();
    }

    
Sets the trusted attribute certificate issuers. If attribute certificates is verified the trusted AC issuers must be set.

The trustedACIssuers must be a Set of TrustAnchor

The given set is cloned.

Parameters:
trustedACIssuers The trusted AC issuers to set. Is never null.
Throws:
java.lang.ClassCastException if an element of stores is not a TrustAnchor.
    public void setTrustedACIssuers(Set trustedACIssuers)
    {
        if (trustedACIssuers == null)
        {
            this..clear();
            return;
        }
        for (Iterator it = trustedACIssuers.iterator(); it.hasNext();)
        {
            if (!(it.next() instanceof TrustAnchor))
            {
                throw new ClassCastException("All elements of set must be "
                    + "of type " + TrustAnchor.class.getName() + ".");
            }
        }
        this..clear();
        this..addAll(trustedACIssuers);
    }

    
Returns the neccessary attributes which must be contained in an attribute certificate.

The returned Set is immutable and contains Strings with the OIDs.

Returns:
Returns the necessary AC attributes.
    public Set getNecessaryACAttributes()
    {
        return Collections.unmodifiableSet();
    }

    
Sets the neccessary which must be contained in an attribute certificate.

The Set must contain Strings with the OIDs.

The set is cloned.

Parameters:
necessaryACAttributes The necessary AC attributes to set.
Throws:
java.lang.ClassCastException if an element of necessaryACAttributes is not a String.
    public void setNecessaryACAttributes(Set necessaryACAttributes)
    {
        if (necessaryACAttributes == null)
        {
            this..clear();
            return;
        }
        for (Iterator it = necessaryACAttributes.iterator(); it.hasNext();)
        {
            if (!(it.next() instanceof String))
            {
                throw new ClassCastException("All elements of set must be "
                    + "of type String.");
            }
        }
        this..clear();
        this..addAll(necessaryACAttributes);
    }

    
Returns the attribute certificates which are not allowed.

The returned Set is immutable and contains Strings with the OIDs.

Returns:
Returns the prohibited AC attributes. Is never null.
    {
        return Collections.unmodifiableSet();
    }

    
Sets the attribute certificates which are not allowed.

The Set must contain Strings with the OIDs.

The set is cloned.

Parameters:
prohibitedACAttributes The prohibited AC attributes to set.
Throws:
java.lang.ClassCastException if an element of prohibitedACAttributes is not a String.
    public void setProhibitedACAttributes(Set prohibitedACAttributes)
    {
        if (prohibitedACAttributes == null)
        {
            this..clear();
            return;
        }
        for (Iterator it = prohibitedACAttributes.iterator(); it.hasNext();)
        {
            if (!(it.next() instanceof String))
            {
                throw new ClassCastException("All elements of set must be "
                    + "of type String.");
            }
        }
        this..clear();
        this..addAll(prohibitedACAttributes);
    }

    
Returns the attribute certificate checker. The returned set contains PKIXAttrCertCheckers and is immutable.

Returns:
Returns the attribute certificate checker. Is never null.
    public Set getAttrCertCheckers()
    {
        return Collections.unmodifiableSet();
    }

    
Sets the attribute certificate checkers.

All elements in the Set must a PKIXAttrCertChecker.

The given set is cloned.

Parameters:
attrCertCheckers The attribute certificate checkers to set. Is never null.
Throws:
java.lang.ClassCastException if an element of attrCertCheckers is not a PKIXAttrCertChecker.
    public void setAttrCertCheckers(Set attrCertCheckers)
    {
        if (attrCertCheckers == null)
        {
            this..clear();
            return;
        }
        for (Iterator it = attrCertCheckers.iterator(); it.hasNext();)
        {
            if (!(it.next() instanceof PKIXAttrCertChecker))
            {
                throw new ClassCastException("All elements of set must be "
                    + "of type " + PKIXAttrCertChecker.class.getName() + ".");
            }
        }
        this..clear();
        this..addAll(attrCertCheckers);
    }
New to GrepCode? Check out our FAQ X