}
// Get the private key.
PrivateKey key = (PrivateKey) keyStore.getKey(certificateAlias, password);
if (key == null) {
throw new NoPrivateKeyException(messages.getString(
"Unable_to_find_the_private_key_corresponding_to_the_certificate."));
}
// Get the certificate chain.
Certificate[] chain = keyStore.getCertificateChain(certificateAlias);