public void startTerminalSimulation() {
		BufferedReader in = new BufferedReader(new InputStreamReader(
				System.in));
		
		String userId;
		long lUserId;
		try {
			System.out.println("terminal> UserId: ");
			userId = in.readLine();
		} catch (IOException e) {
			return;
		}
		try {
			lUserId = Long.parseLong(userId);
		} catch (NumberFormatException nfe) {
			System.out.println("terminal> ERR: invalid user id");
			return;
		}
		
		// request challenge from securedobject
		byte[] challenge = so.getChallenge(id);
		
		// get encrypted challenge (in real system provided by smartcard)
		PrivateKey priv;
		try {
			 priv = getPrivateKey(Config.RESOURCE_DIRECTORY + "/terminal/smartcardkeys/" + lUserId + ".pem");
		} catch (IOException e) {
			System.out.println("terminal> ERR: couldn't read private key (wrong pin?)");
			return;
		}
		
		byte[] response;
		try {
			Cipher rsaEncrypt = Cipher.getInstance(Config.RSA_CIPHER_NAME);
			rsaEncrypt.init(Cipher.ENCRYPT_MODE, priv);
			response = rsaEncrypt.doFinal(challenge);
		} catch (NoSuchAlgorithmException e) {
			System.out.println("terminal> ERR: no such algorithm");
			return;
		} catch (NoSuchPaddingException e) {
			System.out.println("terminal> ERR: no such padding");
			return;
		} catch (IllegalBlockSizeException e) {
			System.out.println("terminal> ERR: illegal block size");
			return;
		} catch (BadPaddingException e) {
			System.out.println("terminal> ERR: bad padding");
			return;
		} catch (InvalidKeyException e) {
			System.out.println("terminal> ERR: invalid key");
			return;
		}
		
		if(so.authenticate(response, lUserId, id)) {
			System.out.println("terminal> *green LED*");
		} else {
			System.out.println("terminal> *red LED*");
		}
	}