Java中的提供程序get()方法
可以使用类java.security.Provider中的get()方法获取键所映射到的值。此方法需要一个参数,即需要其值的键。它返回键所映射的值;如果不存在键所映射的值,则返回null。
演示此的程序如下所示-
示例
import java.security.*;
import java.util.*;
public class Demo {
public static void main(String[] argv) {
try {
SecureRandom sRandom = SecureRandom.getInstance("SHA1PRNG");
Provider p = sRandom.getProvider();
Set<Object> set = p.keySet();
Iterator i = set.iterator();
int x = 30;
while (x > 0) {
Object val = p.get(i.next());
System.out.println(val);
x--;
}
} catch (NoSuchAlgorithmException e) {
System.out.println("Error!!! NoSuchAlgorithmException");
}
}
}上面程序的输出如下-
输出结果
SHA1withDSA SHA1withDSA SHA1withDSA Software sun.security.provider.JavaKeyStore$DualFormatJKS SHA sun.security.provider.SHA sun.security.provider.JavaKeyStore$CaseExactJKS Software sun.security.provider.DSA$SHA256withDSA SHA SHA1withDSA Software Software Software sun.security.provider.DSA$RawDSA X.509 java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey sun.security.provider.certpath.IndexedCollectionCertStore sun.security.provider.Sun SHA SHA1withDSA sun.security.provider.DomainKeyStore$DKS Software SHA256withDSA SHA224withDSA 1024 1024 Software sun.security.provider.DSAKeyFactory
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短