VOOZH about

URL: https://www.geeksforgeeks.org/java/keystore-iskeyentry-method-in-java-with-examples/

⇱ KeyStore isKeyEntry() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

KeyStore isKeyEntry() method in Java with Examples

Last Updated : 2 Feb, 2023

The isKeyEntry() method of java.security.KeyStore class is used to check if the particular specified key entry is present. It returns a boolean value stating the same.

Syntax: 

public final boolean isKeyEntry(String alias) 
 throws KeyStoreException

Parameter: This method accepts the name of the alias as a parameter whose key entry to be checked.

Return Value: This method returns a boolean value stating the presence of the requested key entry.

Exception: This method throws KeyStoreException if you don't initialize this keystore.

Note: All the programs in this article won’t run on online IDE as no ‘privatekey’ Keystore exists. You can check this code on Java compiler on your system. To check this code, create a Keystore ‘privatekey’ on your system and set your own Keystore password to access that Keystore.

Below are the examples to illustrate the isKeyEntry() method:

Example 1:

Output:

👁 Image

Example 2: For KeyStoreException

Comment