@Test void aggregateVerifyReturnsFalseForEmptyPubkeysList() { assertFalse(BLS.aggregateVerify(new ArrayList<>(), new ArrayList<>(), BLSSignature.empty())); }
public static boolean aggregateVerify( List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature) { checkArgument( publicKeys.size() == messages.size(), "Number of public keys and number of messages differs."); if (publicKeys.isEmpty()) return false; if (new HashSet<>(messages).size() != messages.size()) return false; List<PublicKeyMessagePair> publicKeyMessagePairs = Streams.zip( publicKeys.stream(), messages.stream(), (pk, msg) -> new PublicKeyMessagePair(pk.getPublicKey(), msg)) .collect(Collectors.toList()); return signature.getSignature().verify(publicKeyMessagePairs); }
BLS { public static boolean aggregateVerify( List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature) { checkArgument( publicKeys.size() == messages.size(), "Number of public keys and number of messages differs."); if (publicKeys.isEmpty()) return false; if (new HashSet<>(messages).size() != messages.size()) return false; List<PublicKeyMessagePair> publicKeyMessagePairs = Streams.zip( publicKeys.stream(), messages.stream(), (pk, msg) -> new PublicKeyMessagePair(pk.getPublicKey(), msg)) .collect(Collectors.toList()); return signature.getSignature().verify(publicKeyMessagePairs); } }
BLS { public static boolean aggregateVerify( List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature) { checkArgument( publicKeys.size() == messages.size(), "Number of public keys and number of messages differs."); if (publicKeys.isEmpty()) return false; if (new HashSet<>(messages).size() != messages.size()) return false; List<PublicKeyMessagePair> publicKeyMessagePairs = Streams.zip( publicKeys.stream(), messages.stream(), (pk, msg) -> new PublicKeyMessagePair(pk.getPublicKey(), msg)) .collect(Collectors.toList()); return signature.getSignature().verify(publicKeyMessagePairs); }  }
BLS { public static boolean aggregateVerify( List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature) { checkArgument( publicKeys.size() == messages.size(), "Number of public keys and number of messages differs."); if (publicKeys.isEmpty()) return false; if (new HashSet<>(messages).size() != messages.size()) return false; List<PublicKeyMessagePair> publicKeyMessagePairs = Streams.zip( publicKeys.stream(), messages.stream(), (pk, msg) -> new PublicKeyMessagePair(pk.getPublicKey(), msg)) .collect(Collectors.toList()); return signature.getSignature().verify(publicKeyMessagePairs); }  static void setBlsImplementation(BLS12381 blsImpl); static void resetBlsImplementation(); static BLSSignature sign(BLSSecretKey secretKey, Bytes message); static boolean verify(BLSPublicKey publicKey, Bytes message, BLSSignature signature); static BLSSignature aggregate(List<BLSSignature> signatures); static boolean aggregateVerify(
      List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature); static boolean fastAggregateVerify(
      List<BLSPublicKey> publicKeys, Bytes message, BLSSignature signature); static boolean batchVerify(
      List<List<BLSPublicKey>> publicKeys, List<Bytes> messages, List<BLSSignature> signatures); static boolean batchVerify(
      List<List<BLSPublicKey>> publicKeys,
      List<Bytes> messages,
      List<BLSSignature> signatures,
      boolean doublePairing,
      boolean parallel); static BatchSemiAggregate prepareBatchVerify(
      int index, List<BLSPublicKey> publicKeys, Bytes message, BLSSignature signature); static BatchSemiAggregate prepareBatchVerify2(
      int index,
      List<BLSPublicKey> publicKeys1,
      Bytes message1,
      BLSSignature signature1,
      List<BLSPublicKey> publicKeys2,
      Bytes message2,
      BLSSignature signature2); static boolean completeBatchVerify(List<BatchSemiAggregate> preparedSignatures); static BLSSignature sign(BLSSecretKey secretKey, Bytes message, Bytes dst); static boolean verify(
      BLSPublicKey publicKey, Bytes message, BLSSignature signature, Bytes dst); }
BLS { public static boolean aggregateVerify( List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature) { checkArgument( publicKeys.size() == messages.size(), "Number of public keys and number of messages differs."); if (publicKeys.isEmpty()) return false; if (new HashSet<>(messages).size() != messages.size()) return false; List<PublicKeyMessagePair> publicKeyMessagePairs = Streams.zip( publicKeys.stream(), messages.stream(), (pk, msg) -> new PublicKeyMessagePair(pk.getPublicKey(), msg)) .collect(Collectors.toList()); return signature.getSignature().verify(publicKeyMessagePairs); }  static void setBlsImplementation(BLS12381 blsImpl); static void resetBlsImplementation(); static BLSSignature sign(BLSSecretKey secretKey, Bytes message); static boolean verify(BLSPublicKey publicKey, Bytes message, BLSSignature signature); static BLSSignature aggregate(List<BLSSignature> signatures); static boolean aggregateVerify(
      List<BLSPublicKey> publicKeys, List<Bytes> messages, BLSSignature signature); static boolean fastAggregateVerify(
      List<BLSPublicKey> publicKeys, Bytes message, BLSSignature signature); static boolean batchVerify(
      List<List<BLSPublicKey>> publicKeys, List<Bytes> messages, List<BLSSignature> signatures); static boolean batchVerify(
      List<List<BLSPublicKey>> publicKeys,
      List<Bytes> messages,
      List<BLSSignature> signatures,
      boolean doublePairing,
      boolean parallel); static BatchSemiAggregate prepareBatchVerify(
      int index, List<BLSPublicKey> publicKeys, Bytes message, BLSSignature signature); static BatchSemiAggregate prepareBatchVerify2(
      int index,
      List<BLSPublicKey> publicKeys1,
      Bytes message1,
      BLSSignature signature1,
      List<BLSPublicKey> publicKeys2,
      Bytes message2,
      BLSSignature signature2); static boolean completeBatchVerify(List<BatchSemiAggregate> preparedSignatures); static BLSSignature sign(BLSSecretKey secretKey, Bytes message, Bytes dst); static boolean verify(
      BLSPublicKey publicKey, Bytes message, BLSSignature signature, Bytes dst);  }