@Test void testCorruptedSignature() { byte[] message = "Hello".getBytes(UTF_8); List<SignatureAndPublicKey> sigs = getSignaturesAndPublicKeys(message); KeyPair keyPair = KeyPair.random(); byte[] notHello = "Not Hello".getBytes(UTF_8); SignatureAndPublicKey additionalSignature = BLS12381.sign(keyPair, notHello, 48); sigs.add(additionalSignature); SignatureAndPublicKey sigAndPubKey = SignatureAndPublicKey.aggregate(sigs); Boolean isValid = BLS12381.verify(sigAndPubKey, message, 48); assertFalse(isValid); }
public static Signature aggregate(List<Signature> signatures) { if (signatures.isEmpty()) { throw new IllegalArgumentException("Parameter list is empty"); } return signatures.stream().reduce(Signature::combine).get(); }
Signature { public static Signature aggregate(List<Signature> signatures) { if (signatures.isEmpty()) { throw new IllegalArgumentException("Parameter list is empty"); } return signatures.stream().reduce(Signature::combine).get(); } }
Signature { public static Signature aggregate(List<Signature> signatures) { if (signatures.isEmpty()) { throw new IllegalArgumentException("Parameter list is empty"); } return signatures.stream().reduce(Signature::combine).get(); } Signature(G2Point point); }
Signature { public static Signature aggregate(List<Signature> signatures) { if (signatures.isEmpty()) { throw new IllegalArgumentException("Parameter list is empty"); } return signatures.stream().reduce(Signature::combine).get(); } Signature(G2Point point); static Signature aggregate(List<Signature> signatures); static Signature decode(Bytes bytes); Signature combine(Signature signature); Bytes encode(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
Signature { public static Signature aggregate(List<Signature> signatures) { if (signatures.isEmpty()) { throw new IllegalArgumentException("Parameter list is empty"); } return signatures.stream().reduce(Signature::combine).get(); } Signature(G2Point point); static Signature aggregate(List<Signature> signatures); static Signature decode(Bytes bytes); Signature combine(Signature signature); Bytes encode(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }