DocumentException,
GeneralSecurityException
{
// Validate the certificate alias.
if (keyStore.getCertificate(certificateAlias) == null) {
throw new InvalidCertificateAliasException(messages.getString(
"Unable_to_find_a_certificate_corresponding_to_the_given_alias."));
}
// Get the private key.
PrivateKey key = (PrivateKey) keyStore.getKey(certificateAlias, password);