Provider entrySet() method in Java

Java 8ProgrammingObject Oriented Programming

<p>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.</p><p>A program that demonstrates this is given as follows &minus;</p><h2>Example</h2><p><a class="demo" href="http://tpcg.io/FQs3UH" rel="nofollow" target="_blank">&nbsp;Live Demo</a></p><pre class="prettyprint notranslate">import java.security.*; import java.util.*; public class Demo { &nbsp; &nbsp;public static void main(String[] argv) { &nbsp; &nbsp; &nbsp; try { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SecureRandom sRandom = SecureRandom.getInstance(&quot;SHA1PRNG&quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Provider p = sRandom.getProvider(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Set&lt;Map.Entry&lt;Object, Object&gt;&gt; set = p.entrySet(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Iterator i = set.iterator(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;The Unmodifiable Set View is as follows: &quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int x = 30; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while (x &gt; 0) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(i.next()); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x--; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; } catch (NoSuchAlgorithmException e) { System.out.println(&quot;Error!!! NoSuchAlgorithmException&quot;); } } }</pre><h2>Output</h2><pre class="result notranslate">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</pre>
raja
Updated on 30-Jul-2019 22:30:25

Advertisements