![]() |
VOOZH | about |
The getCertificateAlias() method of java.security.KeyStore class is used to get name of the first KeyStore entry which has the specified Certificate.
Syntax:
public final String getCertificateAlias(Certificate cert) throws KeyStoreException
Parameter: This method accepts the certificate name a parameter which is to be matched with Keystore entry.
Return Value: This method returns the name of the first KeyStore entry which has the specified Certificate.
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 getCertificateAlias() method:
Example 1:
Example 2: For KeyStoreException