// let's not even start if the current date is not within the validity period for the SSL cert
try {
((X509Certificate)cert).checkValidity();
} catch (CertificateExpiredException e) {
throw new ServiceLifecycleException("Gateway SSL Certificate is Expired. Server will not start.", e);
} catch (CertificateNotYetValidException e) {
throw new ServiceLifecycleException("Gateway SSL Certificate is not yet valid. Server will not start.", e);
}
}
else {
throw new ServiceLifecycleException("Public certificate for the gateway cannot be found with the alias gateway-identity. Plase check the identity certificate alias.");
}
}
else {
throw new ServiceLifecycleException("Public certificate for the gateway is not of the expected type of X509Certificate. Something is wrong with the gateway keystore.");
}
}