KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) getSignSession().extendedService(admin, caid,
KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) signsession.extendedService(admin, caid,
    public KeyRecoveryData keyRecovery(Admin admin, String username) {        debug(">keyRecovery(user: " + username + ")");        KeyRecoveryData returnval = null;        KeyRecoveryDataLocal krd = null;        X509Certificate certificate = null;        try {            Collection result = keyrecoverydatahome.findByUserMark(username);            Iterator i = result.iterator();            try {                while (i.hasNext()) {                    krd = (KeyRecoveryDataLocal) i.next();                    if (returnval == null) {                        int caid = krd.getIssuerDN().hashCode();                        KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) getSignSession().extendedService(admin, caid,                                new KeyRecoveryCAServiceRequest(KeyRecoveryCAServiceRequest.COMMAND_DECRYPTKEYS, krd.getKeyDataAsByteArray()));                        KeyPair keys = response.getKeyPair();                        returnval = new KeyRecoveryData(krd.getCertificateSN(), krd.getIssuerDN(),                                krd.getUsername(), krd.getMarkedAsRecoverable(), keys);                        certificate = (X509Certificate) getCertificateStoreSession()                                .findCertificateByIssuerAndSerno(admin,                                        krd.getIssuerDN(), krd.getCertificateSN());                    }                    krd.setMarkedAsRecoverable(false);                }                getLogSession().log(admin, admin.getCAId(), LogEntry.MODULE_KEYRECOVERY, new java.util.Date(),                        username, certificate, LogEntry.EVENT_INFO_KEYRECOVERY,                        "Keydata for user: " + username + " have been sent for key recovery.");            } catch (Exception e) {                log.error("-keyRecovery: ", e);                getLogSession().log(admin, admin.getCAId(), LogEntry.MODULE_KEYRECOVERY, new java.util.Date(),                        username, null, LogEntry.EVENT_ERROR_KEYRECOVERY,                        "Error when trying to revover key data.");            }        } catch (FinderException e) {        }        debug("<keyRecovery()");        return returnval;    } // keyRecovery