01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Vladimir N. Molotkov
20: * @version $Revision$
21: */package java.security.cert;
22:
23: import java.security.InvalidAlgorithmParameterException;
24: import java.security.InvalidParameterException;
25: import java.security.KeyStore;
26: import java.security.KeyStoreException;
27: import java.util.Set;
28:
29: import org.apache.harmony.security.internal.nls.Messages;
30:
31: /**
32: * @com.intel.drl.spec_ref
33: *
34: */
35: public class PKIXBuilderParameters extends PKIXParameters {
36: // Maximum certificate path length (5 by default)
37: private int maxPathLength = 5;
38:
39: /**
40: * @com.intel.drl.spec_ref
41: */
42: public PKIXBuilderParameters(Set<TrustAnchor> trustAnchors,
43: CertSelector targetConstraints)
44: throws InvalidAlgorithmParameterException {
45: super (trustAnchors);
46: super .setTargetCertConstraints(targetConstraints);
47: }
48:
49: /**
50: * @com.intel.drl.spec_ref
51: */
52: public PKIXBuilderParameters(KeyStore keyStore,
53: CertSelector targetConstraints) throws KeyStoreException,
54: InvalidAlgorithmParameterException {
55: super (keyStore);
56: super .setTargetCertConstraints(targetConstraints);
57: }
58:
59: /**
60: * @com.intel.drl.spec_ref
61: */
62: public int getMaxPathLength() {
63: return maxPathLength;
64: }
65:
66: /**
67: * @com.intel.drl.spec_ref
68: */
69: public void setMaxPathLength(int maxPathLength) {
70: if (maxPathLength < -1) {
71: throw new InvalidParameterException(Messages
72: .getString("security.5B")); //$NON-NLS-1$
73: }
74: this .maxPathLength = maxPathLength;
75: }
76:
77: /**
78: * @com.intel.drl.spec_ref
79: */
80: public String toString() {
81: StringBuffer sb = new StringBuffer("[\n"); //$NON-NLS-1$
82: sb.append(super .toString());
83: sb.append(" Max Path Length: "); //$NON-NLS-1$
84: sb.append(maxPathLength);
85: sb.append("\n]"); //$NON-NLS-1$
86: return sb.toString();
87: }
88: }
|