27 |
27 |
28 import java.io.InputStream; |
28 import java.io.InputStream; |
29 import java.util.Collection; |
29 import java.util.Collection; |
30 import java.util.Iterator; |
30 import java.util.Iterator; |
31 import java.util.List; |
31 import java.util.List; |
|
32 import java.util.Objects; |
32 import java.security.Provider; |
33 import java.security.Provider; |
33 import java.security.Security; |
34 import java.security.Security; |
34 import java.security.AccessController; |
|
35 import java.security.PrivilegedAction; |
|
36 import java.security.NoSuchAlgorithmException; |
35 import java.security.NoSuchAlgorithmException; |
37 import java.security.NoSuchProviderException; |
36 import java.security.NoSuchProviderException; |
38 |
37 |
39 import sun.security.jca.*; |
38 import sun.security.jca.*; |
40 import sun.security.jca.GetInstance.Instance; |
39 import sun.security.jca.GetInstance.Instance; |
175 * See the CertificateFactory section in the <a href= |
174 * See the CertificateFactory section in the <a href= |
176 * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> |
175 * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> |
177 * Java Cryptography Architecture Standard Algorithm Name Documentation</a> |
176 * Java Cryptography Architecture Standard Algorithm Name Documentation</a> |
178 * for information about standard certificate types. |
177 * for information about standard certificate types. |
179 * |
178 * |
180 * @return a certificate factory object for the specified type. |
179 * @return a certificate factory object for the specified type |
181 * |
180 * |
182 * @exception CertificateException if no Provider supports a |
181 * @throws CertificateException if no {@code Provider} supports a |
183 * CertificateFactorySpi implementation for the |
182 * {@code CertificateFactorySpi} implementation for the |
184 * specified type. |
183 * specified type |
|
184 * |
|
185 * @throws NullPointerException if {@code type} is {@code null} |
185 * |
186 * |
186 * @see java.security.Provider |
187 * @see java.security.Provider |
187 */ |
188 */ |
188 public static final CertificateFactory getInstance(String type) |
189 public static final CertificateFactory getInstance(String type) |
189 throws CertificateException { |
190 throws CertificateException { |
|
191 Objects.requireNonNull(type, "null type name"); |
190 try { |
192 try { |
191 Instance instance = GetInstance.getInstance("CertificateFactory", |
193 Instance instance = GetInstance.getInstance("CertificateFactory", |
192 CertificateFactorySpi.class, type); |
194 CertificateFactorySpi.class, type); |
193 return new CertificateFactory((CertificateFactorySpi)instance.impl, |
195 return new CertificateFactory((CertificateFactorySpi)instance.impl, |
194 instance.provider, type); |
196 instance.provider, type); |
215 * Java Cryptography Architecture Standard Algorithm Name Documentation</a> |
217 * Java Cryptography Architecture Standard Algorithm Name Documentation</a> |
216 * for information about standard certificate types. |
218 * for information about standard certificate types. |
217 * |
219 * |
218 * @param provider the name of the provider. |
220 * @param provider the name of the provider. |
219 * |
221 * |
220 * @return a certificate factory object for the specified type. |
222 * @return a certificate factory object for the specified type |
221 * |
223 * |
222 * @exception CertificateException if a CertificateFactorySpi |
224 * @throws CertificateException if a {@code CertificateFactorySpi} |
223 * implementation for the specified algorithm is not |
225 * implementation for the specified algorithm is not |
224 * available from the specified provider. |
226 * available from the specified provider |
225 * |
227 * |
226 * @exception NoSuchProviderException if the specified provider is not |
228 * @throws IllegalArgumentException if the provider name is {@code null} |
227 * registered in the security provider list. |
229 * or empty |
228 * |
230 * |
229 * @exception IllegalArgumentException if the provider name is null |
231 * @throws NoSuchProviderException if the specified provider is not |
230 * or empty. |
232 * registered in the security provider list |
|
233 * |
|
234 * @throws NullPointerException if {@code type} is {@code null} |
231 * |
235 * |
232 * @see java.security.Provider |
236 * @see java.security.Provider |
233 */ |
237 */ |
234 public static final CertificateFactory getInstance(String type, |
238 public static final CertificateFactory getInstance(String type, |
235 String provider) throws CertificateException, |
239 String provider) throws CertificateException, |
236 NoSuchProviderException { |
240 NoSuchProviderException { |
|
241 Objects.requireNonNull(type, "null type name"); |
237 try { |
242 try { |
238 Instance instance = GetInstance.getInstance("CertificateFactory", |
243 Instance instance = GetInstance.getInstance("CertificateFactory", |
239 CertificateFactorySpi.class, type, provider); |
244 CertificateFactorySpi.class, type, provider); |
240 return new CertificateFactory((CertificateFactorySpi)instance.impl, |
245 return new CertificateFactory((CertificateFactorySpi)instance.impl, |
241 instance.provider, type); |
246 instance.provider, type); |
258 * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> |
263 * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> |
259 * Java Cryptography Architecture Standard Algorithm Name Documentation</a> |
264 * Java Cryptography Architecture Standard Algorithm Name Documentation</a> |
260 * for information about standard certificate types. |
265 * for information about standard certificate types. |
261 * @param provider the provider. |
266 * @param provider the provider. |
262 * |
267 * |
263 * @return a certificate factory object for the specified type. |
268 * @return a certificate factory object for the specified type |
264 * |
269 * |
265 * @exception CertificateException if a CertificateFactorySpi |
270 * @throws CertificateException if a {@code CertificateFactorySpi} |
266 * implementation for the specified algorithm is not available |
271 * implementation for the specified algorithm is not available |
267 * from the specified Provider object. |
272 * from the specified {@code Provider} object |
268 * |
273 * |
269 * @exception IllegalArgumentException if the {@code provider} is |
274 * @throws IllegalArgumentException if the {@code provider} is |
270 * null. |
275 * {@code null} |
|
276 * |
|
277 * @throws NullPointerException if {@code type} is {@code null} |
271 * |
278 * |
272 * @see java.security.Provider |
279 * @see java.security.Provider |
273 * |
280 * |
274 * @since 1.4 |
281 * @since 1.4 |
275 */ |
282 */ |
276 public static final CertificateFactory getInstance(String type, |
283 public static final CertificateFactory getInstance(String type, |
277 Provider provider) throws CertificateException { |
284 Provider provider) throws CertificateException { |
|
285 Objects.requireNonNull(type, "null type name"); |
278 try { |
286 try { |
279 Instance instance = GetInstance.getInstance("CertificateFactory", |
287 Instance instance = GetInstance.getInstance("CertificateFactory", |
280 CertificateFactorySpi.class, type, provider); |
288 CertificateFactorySpi.class, type, provider); |
281 return new CertificateFactory((CertificateFactorySpi)instance.impl, |
289 return new CertificateFactory((CertificateFactorySpi)instance.impl, |
282 instance.provider, type); |
290 instance.provider, type); |