@Test public void generateFromTo() throws Exception { byte[] report = hex2Byte(TCNProtoGenTest.VALIDREPORT); List<String> tcns = new LinkedList<>(); TCNProtoUtil.generateAllTCNsFromReport(report, x -> tcns.add(byte2Hex(x)) ); assertArrayEquals(REPORTTCNS, tcns.toArray()); }
public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) { int from = readUShort(report, 64); byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64); TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from - 1); int to = readUShort(report, 66); callback.next(ratchet.getCurrentTCN()); for (int i = from; i < to; i++) { callback.next(ratchet.getNewTCN()); } }
TCNProtoUtil { public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) { int from = readUShort(report, 64); byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64); TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from - 1); int to = readUShort(report, 66); callback.next(ratchet.getCurrentTCN()); for (int i = from; i < to; i++) { callback.next(ratchet.getNewTCN()); } } }
TCNProtoUtil { public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) { int from = readUShort(report, 64); byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64); TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from - 1); int to = readUShort(report, 66); callback.next(ratchet.getCurrentTCN()); for (int i = from; i < to; i++) { callback.next(ratchet.getNewTCN()); } }  }
TCNProtoUtil { public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) { int from = readUShort(report, 64); byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64); TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from - 1); int to = readUShort(report, 66); callback.next(ratchet.getCurrentTCN()); for (int i = from; i < to; i++) { callback.next(ratchet.getNewTCN()); } }  static boolean verifySignatureOfReportCorrect(byte[] report); static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback); static void persistRatchet(TCNProtoGen ratchet); @RequiresApi(api = 24) static List<TCNProtoGen> loadAllRatchets(); }
TCNProtoUtil { public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) { int from = readUShort(report, 64); byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64); TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from - 1); int to = readUShort(report, 66); callback.next(ratchet.getCurrentTCN()); for (int i = from; i < to; i++) { callback.next(ratchet.getNewTCN()); } }  static boolean verifySignatureOfReportCorrect(byte[] report); static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback); static void persistRatchet(TCNProtoGen ratchet); @RequiresApi(api = 24) static List<TCNProtoGen> loadAllRatchets();  }