Security类中的getImpl方法源码:
Security.getImpl()方法返回的是一个对象数组。
数组的第一位是根据请求的算法以及类型对象的一个实例,
数组的第二位是对应算法提供者的唯一标识。其中provider的值可以为null类型,在这种情况下,将在provider配置文件中搜寻最优先的提供者。
以下是源码
/*
* Returns an array of objects: the first object in the array is
* an instance of an implementation of the requested algorithm* and type, and the second object in the array identifies the provider
* of that implementation.
* The <code>provider</code> argument can be null, in which case all
* configured providers will be searched in order of preference.
*/
static Object[] getImpl(String algorithm, String type, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
if (provider == null) {
return GetInstance.getInstance
(type, getSpiClass(type), algorithm).toArray();
} else {
return GetInstance.getInstance
(type, getSpiClass(type), algorithm, provider).toArray();
}
}