1 /*
2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
127 this.builderSpi = builderSpi;
128 this.provider = provider;
129 this.algorithm = algorithm;
130 }
131
132 /**
133 * Returns a {@code CertPathBuilder} object that implements the
134 * specified algorithm.
135 *
136 * <p> This method traverses the list of registered security Providers,
137 * starting with the most preferred Provider.
138 * A new CertPathBuilder object encapsulating the
139 * CertPathBuilderSpi implementation from the first
140 * Provider that supports the specified algorithm is returned.
141 *
142 * <p> Note that the list of registered providers may be retrieved via
143 * the {@link Security#getProviders() Security.getProviders()} method.
144 *
145 * @implNote
146 * The JDK Reference Implementation additionally uses the
147 * {@code jdk.security.provider.preferred} property to determine
148 * the preferred provider order for the specified algorithm. This
149 * may be different than the order of providers returned by
150 * {@link Security#getProviders() Security.getProviders()}.
151 *
152 * @param algorithm the name of the requested {@code CertPathBuilder}
153 * algorithm. See the CertPathBuilder section in the <a href=
154 * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">
155 * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
156 * for information about standard algorithm names.
157 *
158 * @return a {@code CertPathBuilder} object that implements the
159 * specified algorithm.
160 *
161 * @throws NoSuchAlgorithmException if no Provider supports a
162 * CertPathBuilderSpi implementation for the
163 * specified algorithm.
164 *
165 * @see java.security.Provider
166 */
167 public static CertPathBuilder getInstance(String algorithm)
|
1 /*
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
127 this.builderSpi = builderSpi;
128 this.provider = provider;
129 this.algorithm = algorithm;
130 }
131
132 /**
133 * Returns a {@code CertPathBuilder} object that implements the
134 * specified algorithm.
135 *
136 * <p> This method traverses the list of registered security Providers,
137 * starting with the most preferred Provider.
138 * A new CertPathBuilder object encapsulating the
139 * CertPathBuilderSpi implementation from the first
140 * Provider that supports the specified algorithm is returned.
141 *
142 * <p> Note that the list of registered providers may be retrieved via
143 * the {@link Security#getProviders() Security.getProviders()} method.
144 *
145 * @implNote
146 * The JDK Reference Implementation additionally uses the
147 * {@code jdk.security.provider.preferred}
148 * {@link Security#getProperty(String) Security} property to determine
149 * the preferred provider order for the specified algorithm. This
150 * may be different than the order of providers returned by
151 * {@link Security#getProviders() Security.getProviders()}.
152 *
153 * @param algorithm the name of the requested {@code CertPathBuilder}
154 * algorithm. See the CertPathBuilder section in the <a href=
155 * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">
156 * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
157 * for information about standard algorithm names.
158 *
159 * @return a {@code CertPathBuilder} object that implements the
160 * specified algorithm.
161 *
162 * @throws NoSuchAlgorithmException if no Provider supports a
163 * CertPathBuilderSpi implementation for the
164 * specified algorithm.
165 *
166 * @see java.security.Provider
167 */
168 public static CertPathBuilder getInstance(String algorithm)
|