CertTools.installBCProvider();
try {  ISignSessionHome home = (ISignSessionHome) javax.rmi.PortableRemoteObject.narrow(getInitialContext().lookup("RSASignSession"), ISignSessionHome.class); ISignSessionRemote ss = home.create();  Object obj = getInitialContext().lookup("UserAdminSession"); IUserAdminSessionHome userhome = (IUserAdminSessionHome) javax.rmi.PortableRemoteObject.narrow(obj, IUserAdminSessionHome.class); IUserAdminSessionRemote usersession = userhome.create();  String email = "test@test.se"; if (!usersession.existsUser(admin, user)) { keypair = KeyTools.genKeys(1024); usersession.addUser(admin, user, "foo123", "CN=TESTKEYREC", "rfc822name=" + email, email, false, SecConst.EMPTY_ENDENTITYPROFILE, SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.USER_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, "CN=TEST".hashCode()); cert = (X509Certificate) ss.createCertificate(admin, user, "foo123", keypair.getPublic()); } } catch (Exception e) { log.error("Exception generating keys/cert: ", e); assertTrue("Exception generating keys/cert", false); }
    public void test01AddKeyPair() throws Exception {        log.debug(">test01AddKeyPair()");        CertTools.installBCProvider();        cacheAdmin.addKeyRecoveryData(admin, cert, user, keypair);        assertTrue("Couldn't save key's in database", cacheAdmin.existsKeys(admin, cert));        log.debug("<test01AddKeyPair()");    }