X509Certificate cert = (X509Certificate) ss.createCertificate(administrator, username, password, new PKCS10RequestMessage(buffer));
PKCS10RequestMessage p10 = new PKCS10RequestMessage(buffer); p10.setUsername(username); p10.setPassword(password); IResponseMessage resp = ss.createCertificate(administrator, p10, Class.forName("se.anatom.ejbca.protocol.X509ResponseMessage")); X509Certificate cert = CertTools.getCertfromByteArray(resp.getResponseMessage());
    public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException {        System.out.println("TODO");        //TODO                /*                try {            if (args.length < 5) {                System.out.println(                    "Usage: CA processreq <username> <password> <request-file> <outfile>");                System.out.println(                    "Used to receive certificate requests from subCAs and generate certificates to be sent back.");                return;            }            String username = args[1];            String password = args[2];            String reqfile = args[3];            String outfile = args[4];            System.out.println("Processing cert request:");            System.out.println("Username: " + username);            System.out.println("Password: " + password);            System.out.println("Request file: " + reqfile);            byte[] b64Encoded = FileTools.readFiletoBuffer(reqfile);            byte[] buffer;            try {                String beginKey = "-----BEGIN CERTIFICATE REQUEST-----";                String endKey = "-----END CERTIFICATE REQUEST-----";                buffer = FileTools.getBytesFromPEM(b64Encoded, beginKey, endKey);            } catch (IOException e) {                String beginKey = "-----BEGIN NEW CERTIFICATE REQUEST-----";                String endKey = "-----END NEW CERTIFICATE REQUEST-----";                buffer = FileTools.getBytesFromPEM(b64Encoded, beginKey, endKey);            }            Context ctx = getInitialContext();            ISignSessionHome home = (ISignSessionHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup(                        "RSASignSession"), ISignSessionHome.class);            ISignSessionRemote ss = home.create();            X509Certificate cert = (X509Certificate) ss.createCertificate(administrator, username,                    password, new PKCS10RequestMessage(buffer));            FileOutputStream fos = new FileOutputStream(outfile);            fos.write("-----BEGIN CERTIFICATE-----\n".getBytes());            fos.write(Base64.encode(cert.getEncoded()));            fos.write("\n-----END CERTIFICATE-----\n".getBytes());            fos.close();            System.out.println("Wrote certificate (PEM-format) to file " + outfile);        } catch (Exception e) {            throw new ErrorAdminCommandException(e);        }         */    } // execute