Provider elements() method in Java

Java 8ProgrammingObject Oriented Programming

An enumeration of the values in the hash table can be obtained using the method elements() in the class java.security.Provider. This method requires no parameters and it returns the enumeration of the values in the hash table.

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();
         Enumeration<Object> enumeration;
         enumeration = p.elements();
         System.out.println("The Enumeration of the values is: \n");
         while (enumeration.hasMoreElements()) {
            System.out.println(enumeration.nextElement());
         }
      } catch (NoSuchAlgorithmException e) {
         System.out.println("Error!!! NoSuchAlgorithmException");
      }
   }
}

Output

The Enumeration of the values is:
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
sun.security.provider.ConfigFile$Spi
SHA1withDSA
SHA-224
DSA
Software
SHA-512
SHA-384
SHA-256
NONEwithDSA
SUN
DSA
RFC3280
sun.security.provider.PolicySpiFile
2048
DSA
DSA
SHA1withDSA
DSA
sun.security.provider.SHA5$SHA384
sun.security.provider.SHA2$SHA224
Software
sun.security.provider.DSAParameterGenerator
java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey
sun.security.provider.NativePRNG$Blocking
sun.security.provider.SHA5$SHA512
DSA
sun.security.provider.certpath.SunCertPathBuilder
SHA1withDSA
SHA-224
Software
SHA-512
1.8
SHA-384
2048
SHA-256
sun.security.provider.DSAParameters
java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey
sun.security.provider.certpath.CollectionCertStore
Software
sun.security.provider.NativePRNG$NonBlocking
2048
sun.security.provider.certpath.ldap.LDAPCertStore
sun.security.provider.X509Factory
SHA256withDSA
SHA224withDSA
sun.security.provider.NativePRNG
RFC2587
Software
Software
RFC3280
Software
sun.security.provider.DSA$SHA224withDSA
SHA1withDSA
sun.security.provider.certpath.PKIXCertPathValidator
SHA
2048
sun.security.provider.SecureRandom
sun.security.provider.DSA$SHA1withDSA
DSA
Software
sun.security.provider.DSAKeyPairGenerator
SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS & DKS keystores; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration)
DSA
SHA1withDSA
sun.security.provider.MD5
SHA1withDSA
sun.security.provider.SHA2$SHA256
DSA
java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey
sun.security.provider.MD2
raja
Published on 12-Mar-2019 12:05:03
Advertisements