@Test public void testVerifySig() throws Exception { byte[] report = hex2Byte(TCNProtoGenTest.VALIDREPORT); assertEquals(true, TCNProtoUtil.verifySignatureOfReportCorrect(report)); }
public static boolean verifySignatureOfReportCorrect(byte[] report) { byte[] bsignature = Arrays.copyOfRange(report, report.length - 64, report.length); byte[] brvk = getRvkfromReport(report); byte[] breport = Arrays.copyOfRange(report, 0, report.length - 64); try { Ed25519PublicKey rvk = Ed25519PublicKey.fromByteArray(brvk); Ed25519Signature signature = Ed25519Signature.fromByteArray(bsignature); return rvk.verify(breport, signature); } catch (Exception e) { return false; } }
TCNProtoUtil { public static boolean verifySignatureOfReportCorrect(byte[] report) { byte[] bsignature = Arrays.copyOfRange(report, report.length - 64, report.length); byte[] brvk = getRvkfromReport(report); byte[] breport = Arrays.copyOfRange(report, 0, report.length - 64); try { Ed25519PublicKey rvk = Ed25519PublicKey.fromByteArray(brvk); Ed25519Signature signature = Ed25519Signature.fromByteArray(bsignature); return rvk.verify(breport, signature); } catch (Exception e) { return false; } } }
TCNProtoUtil { public static boolean verifySignatureOfReportCorrect(byte[] report) { byte[] bsignature = Arrays.copyOfRange(report, report.length - 64, report.length); byte[] brvk = getRvkfromReport(report); byte[] breport = Arrays.copyOfRange(report, 0, report.length - 64); try { Ed25519PublicKey rvk = Ed25519PublicKey.fromByteArray(brvk); Ed25519Signature signature = Ed25519Signature.fromByteArray(bsignature); return rvk.verify(breport, signature); } catch (Exception e) { return false; } }  }
TCNProtoUtil { public static boolean verifySignatureOfReportCorrect(byte[] report) { byte[] bsignature = Arrays.copyOfRange(report, report.length - 64, report.length); byte[] brvk = getRvkfromReport(report); byte[] breport = Arrays.copyOfRange(report, 0, report.length - 64); try { Ed25519PublicKey rvk = Ed25519PublicKey.fromByteArray(brvk); Ed25519Signature signature = Ed25519Signature.fromByteArray(bsignature); return rvk.verify(breport, signature); } catch (Exception e) { return false; } }  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 boolean verifySignatureOfReportCorrect(byte[] report) { byte[] bsignature = Arrays.copyOfRange(report, report.length - 64, report.length); byte[] brvk = getRvkfromReport(report); byte[] breport = Arrays.copyOfRange(report, 0, report.length - 64); try { Ed25519PublicKey rvk = Ed25519PublicKey.fromByteArray(brvk); Ed25519Signature signature = Ed25519Signature.fromByteArray(bsignature); return rvk.verify(breport, signature); } catch (Exception e) { return false; } }  static boolean verifySignatureOfReportCorrect(byte[] report); static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback); static void persistRatchet(TCNProtoGen ratchet); @RequiresApi(api = 24) static List<TCNProtoGen> loadAllRatchets();  }