public boolean startup() throws IOException
    {
        String userId = node.getUserId();
        RPCMessageFactory messageFactory = node.getMessageFactory();
        NodeSecurityAgent securityAgent = node.getSecurityAgent();
        StringBuilder buffer = new StringBuilder();

        buffer.append("\nStarting initialization protocol");
        try
        {
            //create the node key pair
            buffer.append("\n   " + userId + ": Creating a new Key pair...");
            securityAgent.initKeyPair();
            buffer.append("\n   " + userId + ": Public Key = " + securityAgent.getPublicKey());

            //create a connection to the CA
            buffer.append("\n   " + userId + ": connecting to CA...");
            System.out.println(CA_IP);
            System.out.println(CA_PORT);
            Socket socket = new Socket(CA_IP, CA_PORT);
            //socket.setSoTimeout(timeout);
            buffer.append("\n   " + userId + ": connected to CA!");
            CAMessage request;
            CAMessage response;
            ObjectOutputStream objOut;
            ObjectInputStream objIn;

            // create a request for the CA publicKey and send it to the CA
            buffer.append("\n   " + userId + ": creating key request");
            request = messageFactory.createCAKeyRequest(node.getUserId());
            objOut = new ObjectOutputStream(socket.getOutputStream());
            objOut.writeObject(request);

            //waits for a reply
            buffer.append("\n   " + userId + ": waiting for key response");
            objIn = new ObjectInputStream(socket.getInputStream());
            response = (CAMessage) objIn.readObject();
            if (response.getOpCode().equals(unito.likir.messages.ca.CAMessage.OpCode.ERROR))
            {
                throw new IOException();
            }
            else if (response.getOpCode().equals(unito.likir.messages.ca.CAMessage.OpCode.CA_KEY_RESPONSE))
            {
                CAKeyResponse resp = (CAKeyResponse) response;
                buffer.append("\n   " + userId + ": CA Key achieved!");
                securityAgent.setCAPublicKey(resp.getCAKey());
            }
            else
            {
                throw new IOException();
            }

            //create a connection with CA
            buffer.append("\n   " + userId + ": connecting to CA...");
            socket = new Socket(CA_IP, CA_PORT);

            // create an initialization request and send it to the CA
            buffer.append("\n   " + userId + ": create init request");
            request = messageFactory.createInitRequest(securityAgent.getPublicKey(), null);
            objOut = new ObjectOutputStream(socket.getOutputStream());
            objOut.writeObject(request);

            //waits for a reply
            buffer.append("\n   " + userId + ": waiting for init response");
            objIn = new ObjectInputStream(socket.getInputStream());
            response = (CAMessage) objIn.readObject();
            Collection<Contact> bootList = null;
            if (response.getOpCode().equals(unito.likir.messages.ca.CAMessage.OpCode.ERROR))
            {
                CAErrorMessage err = (CAErrorMessage) response;
                throw new IOException(err.getErrorMessage());
            }
            else if (response.getOpCode().equals(unito.likir.messages.ca.CAMessage.OpCode.INITIALIZATION_RESPONSE))
            {
                buffer.append("\n      " + response);
                InitResponse resp = (InitResponse) response;
                BootstrapList bl = resp.getBootstrapList();
                AuthNodeId ani = resp.getAuthNodeId();
                PublicKey CAPubKey = node.getSecurityAgent().getCAPublicKey();

                //verifies the validity of received information
                try
                {
                    boolean bootListValid = node.getSecurityAgent().verifySignature(bl.getContent(), bl.getSignature(), CAPubKey);
                    boolean authIdValid = node.getSecurityAgent().verifySignature(ani.getContent(), ani.getSignature(), CAPubKey);
                    if (!bootListValid || !authIdValid)
                    {
                        buffer.append("\n   Corrupted infos from CA!!!");
                        System.out.println(buffer.toString());
                        return false;
                    }
                    buffer.append("\n   AuthId and bootstrapList signatures verified!");
                }
                catch (SignatureException se)
                {
                    buffer.append("\n   Can't verify signatures of CA!!!");
                    System.out.println(buffer.toString());
                    return false;
                }

                bootList = resp.getBootstrapList().getContacts();
                securityAgent.setAuthNodeId(resp.getAuthNodeId());

                node.setNodeId(resp.getAuthNodeId().getContent().getNodeId());
            }
            else
            {
                throw new IOException();
            }
            objOut.close();
            objIn.close();
            buffer.append("\n   " + userId + ": initialization successful");
            buffer.append("\n   " + userId + ": AuthNodeId -> " + securityAgent.getAuthNodeId());
            buffer.append("\n" + userId + ":End initialization");
            System.out.println(buffer.toString());

            if (bootList != null)
            {
                this.bootstrapList = bootList;
            }

            return false;

        }
        catch (Exception cnfe)
        {
            cnfe.printStackTrace();
            throw new IOException();
        }
    }