more code
[iotcloud.git] / src / java / iotcloud / Slot.java
index 8b6f61954de6f259d56b08fa2431a8a9df843a2e..8815a5bcbf42784fe1075bf575a86a19858d2779 100644 (file)
@@ -8,11 +8,11 @@ class Slot {
        public static final int SLOT_SIZE=2048;
        public static final int HMAC_SIZE=32;
 
-       long seqnum;
-       byte[] prevhmac;
-       byte[] hmac;
-       long machineid;
-       Vector<Entry> entries;
+       private long seqnum;
+       private byte[] prevhmac;
+       private byte[] hmac;
+       private long machineid;
+       private Vector<Entry> entries;
 
        Slot(long _seqnum, long _machineid, byte[] _prevhmac, byte[] _hmac, Vector<Entry> _entries) {
                seqnum=_seqnum;
@@ -33,6 +33,10 @@ class Slot {
        byte[] getPrevHMAC() {
                return prevhmac;
        }
+
+       Vector<Entry> getEntries() {
+               return entries;
+       }
        
        static Slot decode(byte[] array, Mac mac) {
                mac.update(array, HMAC_SIZE, array.length-HMAC_SIZE);
@@ -44,7 +48,7 @@ class Slot {
                bb.get(hmac);
                bb.get(prevhmac);
                if (!Arrays.equals(realmac, hmac))
-                       throw new Error("Invalid HMAC!  Potential Attack!");
+                       throw new Error("Server Error: Invalid HMAC!  Potential Attack!");
 
                long seqnum=bb.getLong();
                long machineid=bb.getLong();