FileDocCategorySizeDatePackage
PKIXBuilderParameters.javaAPI DocAndroid 1.5 API5132Wed May 06 22:41:06 BST 2009java.security.cert

PKIXBuilderParameters

public class PKIXBuilderParameters extends PKIXParameters
The parameter specification for a PKIX {@code CertPathBuilder} algorithm used to {@link CertPathBuilder#build(CertPathParameters) build} certificate chains validated with the PKIX certification path validation.

The parameters must be created with trusted certificate authorities and constraints for the target certificates.

see
CertPathBuilder
see
CertPathParameters
since
Android 1.0

Fields Summary
private int
maxPathLength
Constructors Summary
public PKIXBuilderParameters(Set trustAnchors, CertSelector targetConstraints)
Creates a new {@code PKIXBuilderParameters} instance with the specified set of {@code TrustAnchor} and certificate constraints.

param
trustAnchors the set of {@code TrustAnchors}.
param
targetConstraints the certificate constraints.
throws
InvalidAlgorithmParameterException if {@code trustAnchors} is empty.
throws
ClassCastException if one of the items in {@code trustAnchors} is not an instance of {@code java.security.cert.TrustAnchor}.
since
Android 1.0


                                                                                                                           
      
             
          
        super(trustAnchors);
        super.setTargetCertConstraints(targetConstraints);
    
public PKIXBuilderParameters(KeyStore keyStore, CertSelector targetConstraints)
Creates a new {@code PKIXBuilderParameters} instance with the trusted {@code X509Certificate} entries from the specified {@code KeyStore}.

param
keyStore the key store containing trusted certificates.
param
targetConstraints the certificate constraints.
throws
KeyStoreException if the {@code keyStore} is not initialized.
throws
InvalidAlgorithmParameterException if {@code keyStore} does not contained any trusted certificate entry.
since
Android 1.0

        super(keyStore);
        super.setTargetCertConstraints(targetConstraints);
    
Methods Summary
public intgetMaxPathLength()
Returns the maximum length of a certification path.

This is the maximum number of non-self-signed certificates in a certification path.

return
the maximum length of a certification path, or {@code -1} if it is unlimited.
since
Android 1.0

        return maxPathLength;
    
public voidsetMaxPathLength(int maxPathLength)
Set the maximum length of a certification path.

This is the maximum number of non-self-signed certificates in a certification path.

param
maxPathLength the maximum length of a certification path.
throws
InvalidParameterException if {@code maxPathLength} is less than {@code -1}.
since
Android 1.0

        if (maxPathLength < -1) {
            throw new InvalidParameterException(
                    Messages.getString("security.5B")); //$NON-NLS-1$
        }
        this.maxPathLength = maxPathLength;
    
public java.lang.StringtoString()
Returns a string representation of this {@code PKIXBuilderParameters} instance.

return
a string representation of this {@code PKIXBuilderParameters} instance.
since
Android 1.0

        StringBuffer sb = new StringBuffer("[\n"); //$NON-NLS-1$
        sb.append(super.toString());
        sb.append(" Max Path Length: "); //$NON-NLS-1$
        sb.append(maxPathLength);
        sb.append("\n]"); //$NON-NLS-1$
        return sb.toString();