Provider 中的 entrySet() 方法(Java)


Provider 中的条目具有一个不可修改的集合视图,该视图可使用 java.security.Provider 类中的 entrySet() 方法获得。此方法不需要参数,并且它返回在 Provider 中条目的不可修改的集合视图。

下面是一个对此的演示程序 -

示例

 实时演示

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<Map.Entry<Object, Object>> set = p.entrySet();
         Iterator i = set.iterator();
         System.out.println("The Unmodifiable Set View is as follows: 
");          int x = 30;          while (x > 0) {             System.out.println(i.next());             x--;          }       } catch (NoSuchAlgorithmException e) { System.out.println("Error!!! NoSuchAlgorithmException"); } } }

输出

The Unmodifiable Set View is as follows:
Alg.Alias.Signature.SHA1/DSA=SHA1withDSA
Alg.Alias.Signature.1.2.840.10040.4.3=SHA1withDSA
Alg.Alias.Signature.DSS=SHA1withDSA
SecureRandom.SHA1PRNG ImplementedIn=Software
KeyStore.JKS=sun.security.provider.JavaKeyStore$DualFormatJKS
Alg.Alias.MessageDigest.SHA-1=SHA
MessageDigest.SHA=sun.security.provider.SHA
KeyStore.CaseExactJKS=sun.security.provider.JavaKeyStore$CaseExactJKS
CertStore.com.sun.security.IndexedCollection ImplementedIn=Software
Signature.SHA256withDSA=sun.security.provider.DSA$SHA256withDSA
Alg.Alias.MessageDigest.OID.1.3.14.3.2.26=SHA
Alg.Alias.Signature.DSA=SHA1withDSA
KeyFactory.DSA ImplementedIn=Software
KeyStore.JKS ImplementedIn=Software
AlgorithmParameters.DSA ImplementedIn=Software
Signature.NONEwithDSA=sun.security.provider.DSA$RawDSA
Alg.Alias.CertificateFactory.X509=X.509
Signature.SHA256withDSA SupportedKeyClasses=java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey
CertStore.com.sun.security.IndexedCollection=sun.security.provider.certpath.IndexedCollectionCertStore
Provider.id className=sun.security.provider.Sun
Alg.Alias.MessageDigest.1.3.14.3.2.26=SHA
Alg.Alias.Signature.SHA-1/DSA=SHA1withDSA
KeyStore.DKS=sun.security.provider.DomainKeyStore$DKS
CertificateFactory.X.509 ImplementedIn=Software
Alg.Alias.Signature.OID.2.16.840.1.101.3.4.3.2=SHA256withDSA
Alg.Alias.Signature.OID.2.16.840.1.101.3.4.3.1=SHA224withDSA
Signature.SHA1withDSA KeySize=1024
Signature.NONEwithDSA KeySize=1024
CertPathValidator.PKIX ImplementedIn=Software
KeyFactory.DSA=sun.security.provider.DSAKeyFactory

更新时间: 2019/07/30

93 次浏览

开启你的职业生涯

通过完成课程,获得认证

开始学习
广告