log.trace(">addKeyRecoveryData(user: " + username + ")");
}
boolean returnval = false;
try {
int caid = CertTools.getIssuerDN(certificate).hashCode();
KeyRecoveryCAServiceResponse response = (KeyRecoveryCAServiceResponse) caAdminSession.extendedService(admin, caid,
new KeyRecoveryCAServiceRequest(KeyRecoveryCAServiceRequest.COMMAND_ENCRYPTKEYS, keypair));
entityManager.persist(new org.ejbca.core.ejb.keyrecovery.KeyRecoveryData(
CertTools.getSerialNumber(certificate), CertTools.getIssuerDN(certificate), username, response.getKeyData()));
// same method to make hex serno as in KeyRecoveryDataBean
String msg = intres.getLocalizedMessage("keyrecovery.addeddata", CertTools.getSerialNumber(certificate).toString(16), CertTools.getIssuerDN(certificate));
logSession.log(admin, certificate, LogConstants.MODULE_KEYRECOVERY, new java.util.Date(), username,
certificate, LogConstants.EVENT_INFO_KEYRECOVERY, msg);
returnval = true;