1 7 8 package java.security.cert; 9 10 import java.security.KeyStore ; 11 import java.security.KeyStoreException ; 12 import java.security.InvalidAlgorithmParameterException ; 13 import java.security.InvalidParameterException ; 14 import java.util.Set ; 15 16 61 public class PKIXBuilderParameters extends PKIXParameters { 62 63 private int maxPathLength = 5; 64 65 84 public PKIXBuilderParameters(Set <TrustAnchor > trustAnchors, CertSelector 85 targetConstraints) throws InvalidAlgorithmParameterException 86 { 87 super(trustAnchors); 88 setTargetCertConstraints(targetConstraints); 89 } 90 91 109 public PKIXBuilderParameters(KeyStore keystore, 110 CertSelector targetConstraints) 111 throws KeyStoreException , InvalidAlgorithmParameterException 112 { 113 super(keystore); 114 setTargetCertConstraints(targetConstraints); 115 } 116 117 147 public void setMaxPathLength(int maxPathLength) { 148 if (maxPathLength < -1) { 149 throw new InvalidParameterException ("the maximum path " 150 + "length parameter can not be less than -1"); 151 } 152 this.maxPathLength = maxPathLength; 153 } 154 155 165 public int getMaxPathLength() { 166 return maxPathLength; 167 } 168 169 174 public String toString() { 175 StringBuffer sb = new StringBuffer (); 176 sb.append("[\n"); 177 sb.append(super.toString()); 178 sb.append(" Maximum Path Length: " + maxPathLength + "\n"); 179 sb.append("]\n"); 180 return sb.toString(); 181 } 182 } 183 | Popular Tags |