Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Provider getProperty() method in Java
A specific key can be used to search for the required property in the property list using the method getProperty() in the class java.security.Provider. This method requires a single parameter i.e. the key required to search for the property. It returns the property value for the key or returns null if the property value is not available.
A program that demonstrates this is given as follows −
Example
import java.security.*;
import java.util.*;
public class Demo {
public static void main(String[] argv) throws Exception {
try {
KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("DSA");
Provider p = kpGenerator.getProvider();
Set<Object> s = p.keySet();
Iterator i = s.iterator();
int x = 30;
while (x > 0) {
System.out.println(p.getProperty((String)i.next()));
x--;
}
} catch (NoSuchAlgorithmException e) {
System.out.println("Error!!! NoSuchAlgorithmException");
}
}
}
Output
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
Advertisements