public boolean validate(Byte host, byte[] data, byte[] hmac) {
		try {
			MessageDigest digest = MessageDigest.getInstance("SHA-256");
			byte[] checkHash = digest.digest(data);
	    	PublicKey pubKey = pubKeys.get(host);
	    	if(pubKey != null) {
		        Cipher rsa;
		        rsa = Cipher.getInstance("RSA/ECB/NoPadding");
		        rsa.init(Cipher.DECRYPT_MODE, pubKey);
		        byte[] realHash = rsa.doFinal(hmac);
		        
		        if(realHash.length != checkHash.length) return false;
		        
		        for(int i = 0; i < checkHash.length; i++) {
		        	if(realHash[i] != checkHash[i]) {
		        		return false;
		        	}
		        }
		        return true;
	    	} else {
	    		System.out.println("Key for host " + host + " not found. Cannot validate.");
	    	}
		} catch(Exception e) {
			e.printStackTrace();
		}
		return false;
	}