/**
* @see org.ejbca.core.protocol.ws.common.IEjbcaWS#getCertificate(String, String)
*/
public Certificate getCertificate(String certSNinHex, String issuerDN) throws CADoesntExistsException,
AuthorizationDeniedException, EjbcaException {
Certificate retval = null;
EjbcaWSHelper ejbhelper = new EjbcaWSHelper(wsContext, authorizationSession, caAdminSession, certificateProfileSession, certificateStoreSession, endEntityProfileSession, hardTokenSession, userAdminSession);
Admin admin = ejbhelper.getAdmin(true);
String bcString = CertTools.stringToBCDNString(issuerDN);
int caid = bcString.hashCode();
final IPatternLogger logger = TransactionLogger.getPatternLogger();
logAdminName(admin,logger);
try {
caAdminSession.verifyExistenceOfCA(caid);
if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.REGULAR_VIEWCERTIFICATE)) {
Authorizer.throwAuthorizationException(admin, AccessRulesConstants.REGULAR_VIEWCERTIFICATE, null);
}
if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.CAPREFIX + caid)) {
Authorizer.throwAuthorizationException(admin, AccessRulesConstants.CAPREFIX + caid, null);
}
java.security.cert.Certificate cert = certificateStoreSession.findCertificateByIssuerAndSerno(admin, issuerDN, new BigInteger(certSNinHex,16));
if(cert != null){
retval = new Certificate(cert);
}
} catch (CertificateEncodingException e) {
throw EjbcaWSHelper.getInternalException(e, logger);
} catch (RuntimeException e) { // EJBException, ...
throw EjbcaWSHelper.getInternalException(e, logger);