Provider entrySet() method in Java

Java 8ProgrammingObject Oriented Programming

The entries in the Provider have an unmodifiable set view that can be obtained using the method entrySet() in the class java.security.Provider. This method requires no parameters and it returns the unmodifiable set view for the entries in the Provider.

A program that demonstrates this is given as follows −

Example

 Live Demo

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: \n ");
         int x = 30;
         while (x > 0) {
            System.out.println(i.next());
            x--;
         }
      } catch (NoSuchAlgorithmException e) {
         System.out.println("Error!!! NoSuchAlgorithmException");
      }
   }
}

Output

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
raja
Published on 12-Mar-2019 12:08:19
Advertisements