bls.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2020-2021 Ilias Khairullin <ilias@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 
26 #ifndef CRYPTO3_PUBKEY_BLS_HPP
27 #define CRYPTO3_PUBKEY_BLS_HPP
28 
29 #include <map>
30 #include <vector>
31 #include <iterator>
32 #include <type_traits>
33 #include <utility>
34 #include <functional>
35 
36 #include <boost/assert.hpp>
37 #include <boost/concept_check.hpp>
38 
39 #include <boost/range/concepts.hpp>
40 
41 #include <boost/mpl/vector.hpp>
42 
43 #include <nil/crypto3/detail/stream_endian.hpp>
44 
47 
49 
56 
57 namespace nil {
58  namespace crypto3 {
59  namespace pubkey {
66  template<typename SignatureVersion>
68  typedef SignatureVersion signature_version;
69  typedef typename signature_version::basic_functions basic_functions;
70 
71  typedef typename basic_functions::private_key_type private_key_type;
72  typedef typename basic_functions::public_key_type public_key_type;
73  typedef typename basic_functions::signature_type signature_type;
74 
75  typedef typename basic_functions::internal_accumulator_type internal_accumulator_type;
76  typedef typename basic_functions::internal_aggregation_accumulator_type
78 
79  static inline public_key_type generate_public_key(const private_key_type &privkey) {
80  return basic_functions::privkey_to_pubkey(privkey);
81  }
82 
83  static inline void init_accumulator(internal_accumulator_type &acc, const private_key_type &privkey) {
84  }
85 
87  }
88 
89  template<typename InputRange>
90  static inline void update(internal_accumulator_type &acc, const InputRange &range) {
91  basic_functions::update(acc, range);
92  }
93 
94  template<typename InputIterator>
95  static inline void update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
96  basic_functions::update(acc, first, last);
97  }
98 
99  static inline signature_type sign(internal_accumulator_type &acc, const private_key_type &privkey) {
100  return basic_functions::sign(acc, privkey);
101  }
102 
103  static inline bool verify(internal_accumulator_type &acc, const public_key_type &pubkey,
104  const signature_type &sig) {
105  return basic_functions::verify(acc, pubkey, sig);
106  }
107 
108  template<typename SignatureRange>
109  static inline void update_aggregate(signature_type &acc, const SignatureRange &signatures) {
110  basic_functions::aggregate(acc, signatures);
111  }
112 
113  template<typename SignatureIterator>
114  static inline void update_aggregate(signature_type &acc, SignatureIterator sig_first,
115  SignatureIterator sig_last) {
116  basic_functions::aggregate(acc, sig_first, sig_last);
117  }
118 
120  const signature_type &signature) {
121  // TODO: add check - If any two input messages are equal, return INVALID.
122  return basic_functions::aggregate_verify(acc, signature);
123  }
124  };
125 
132  template<typename SignatureVersion>
133  struct bls_aug_scheme {
134  typedef SignatureVersion signature_version;
135  typedef typename signature_version::basic_functions basic_functions;
136 
137  typedef typename basic_functions::private_key_type private_key_type;
138  typedef typename basic_functions::public_key_type public_key_type;
139  typedef typename basic_functions::signature_type signature_type;
140 
141  typedef typename basic_functions::internal_accumulator_type internal_accumulator_type;
142  typedef typename basic_functions::internal_aggregation_accumulator_type
144 
145  static inline public_key_type generate_public_key(const private_key_type &privkey) {
146  return basic_functions::privkey_to_pubkey(privkey);
147  }
148 
149  static inline void init_accumulator(internal_accumulator_type &acc, const private_key_type &privkey) {
150  init_accumulator(acc, generate_public_key(privkey));
151  }
152 
154  basic_functions::update(acc, basic_functions::point_to_pubkey(pubkey));
155  }
156 
157  template<typename InputRange>
158  static inline void update(internal_accumulator_type &acc, const InputRange &range) {
159  basic_functions::update(acc, range);
160  }
161 
162  template<typename InputIterator>
163  static inline void update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
164  basic_functions::update(acc, first, last);
165  }
166 
167  static inline signature_type sign(internal_accumulator_type &acc, const private_key_type &privkey) {
168  return basic_functions::sign(acc, privkey);
169  }
170 
171  static inline bool verify(internal_accumulator_type &acc, const public_key_type &pubkey,
172  const signature_type &sig) {
173  return basic_functions::verify(acc, pubkey, sig);
174  }
175 
176  template<typename SignatureRange>
177  static inline void update_aggregate(signature_type &acc, const SignatureRange &signatures) {
178  basic_functions::aggregate(acc, signatures);
179  }
180 
181  template<typename SignatureIterator>
182  static inline void update_aggregate(signature_type &acc, SignatureIterator sig_first,
183  SignatureIterator sig_last) {
184  basic_functions::aggregate(acc, sig_first, sig_last);
185  }
186 
188  const signature_type &signature) {
189  return basic_functions::aggregate_verify(acc, signature);
190  }
191  };
192 
199  template<typename SignatureVersion>
200  struct bls_pop_scheme {
201  typedef SignatureVersion signature_version;
202  typedef typename signature_version::basic_functions basic_functions;
203 
204  typedef typename basic_functions::private_key_type private_key_type;
205  typedef typename basic_functions::public_key_type public_key_type;
206  typedef typename basic_functions::signature_type signature_type;
207 
208  typedef typename basic_functions::internal_accumulator_type internal_accumulator_type;
209  typedef typename basic_functions::internal_aggregation_accumulator_type
211  typedef typename basic_functions::internal_fast_aggregation_accumulator_type
213 
214  static inline public_key_type generate_public_key(const private_key_type &privkey) {
215  return basic_functions::privkey_to_pubkey(privkey);
216  }
217 
218  static inline void init_accumulator(internal_accumulator_type &acc, const private_key_type &privkey) {
219  }
220 
222  }
223 
224  template<typename InputRange>
225  static inline void update(internal_accumulator_type &acc, const InputRange &range) {
226  basic_functions::update(acc, range);
227  }
228 
229  template<typename InputIterator>
230  static inline void update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
231  basic_functions::update(acc, first, last);
232  }
233 
234  static inline signature_type sign(internal_accumulator_type &acc, const private_key_type &privkey) {
235  return basic_functions::sign(acc, privkey);
236  }
237 
238  static inline bool verify(internal_accumulator_type &acc, const public_key_type &pubkey,
239  const signature_type &sig) {
240  return basic_functions::verify(acc, pubkey, sig);
241  }
242 
243  template<typename SignatureRange>
244  static inline void update_aggregate(signature_type &acc, const SignatureRange &signatures) {
245  basic_functions::aggregate(acc, signatures);
246  }
247 
248  template<typename SignatureIterator>
249  static inline void update_aggregate(signature_type &acc, SignatureIterator sig_first,
250  SignatureIterator sig_last) {
251  basic_functions::aggregate(acc, sig_first, sig_last);
252  }
253 
255  const signature_type &signature) {
256  return basic_functions::aggregate_verify(acc, signature);
257  }
258 
260  const signature_type &signature) {
261  return basic_functions::aggregate_verify(acc, signature);
262  }
263 
264  static inline signature_type pop_prove(const private_key_type &privkey) {
265  return basic_functions::pop_prove(privkey);
266  }
267 
268  static inline bool pop_verify(const public_key_type &pubkey, const signature_type &proof) {
269  return basic_functions::pop_verify(pubkey, proof);
270  }
271  };
272 
273  //
274  // Minimal-signature-size
275  // Random oracle version of hash-to-point
276  //
277  template<typename PublicParams, typename CurveType = algebra::curves::bls12_381>
281  };
282 
283  //
284  // Minimal-pubkey-size
285  // Random oracle version of hash-to-point
286  //
287  template<typename PublicParams, typename CurveType = algebra::curves::bls12_381>
291  };
292 
296  constexpr static hashes::UniformityCount uniformity_count = _uniformity_count;
297  constexpr static hashes::ExpandMsgVariant expand_msg_variant = _expand_msg_variant;
298 
299  // "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_"
300  typedef std::array<std::uint8_t, 43> dst_type;
301  static constexpr dst_type dst = {0x42, 0x4c, 0x53, 0x5f, 0x53, 0x49, 0x47, 0x5f, 0x42, 0x4c, 0x53,
302  0x31, 0x32, 0x33, 0x38, 0x31, 0x47, 0x32, 0x5f, 0x58, 0x4d, 0x44,
303  0x3a, 0x53, 0x48, 0x41, 0x2d, 0x32, 0x35, 0x36, 0x5f, 0x53, 0x53,
304  0x57, 0x55, 0x5f, 0x52, 0x4f, 0x5f, 0x4e, 0x55, 0x4c, 0x5f};
305  };
306 
310  constexpr static hashes::UniformityCount uniformity_count = _uniformity_count;
311  constexpr static hashes::ExpandMsgVariant expand_msg_variant = _expand_msg_variant;
312 
313  typedef std::vector<std::uint8_t> dst_type;
314  static inline dst_type dst = []() {
315  const std::string _dst_str = "BLS_POP_BLS12381G1_XMD:SHA-256_SSWU_RO_POP_";
316  const std::vector<std::uint8_t> _dst(_dst_str.begin(), _dst_str.end());
317  return _dst;
318  }();
319  };
320 
324  constexpr static hashes::UniformityCount uniformity_count = _uniformity_count;
325  constexpr static hashes::ExpandMsgVariant expand_msg_variant = _expand_msg_variant;
326 
327  typedef std::vector<std::uint8_t> dst_type;
328  static inline dst_type dst = []() {
329  const std::string _dst_str = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
330  const std::vector<std::uint8_t> _dst(_dst_str.begin(), _dst_str.end());
331  return _dst;
332  }();
333  };
334 
335  template<typename PublicParams = bls_default_public_params<>,
336  template<typename, typename> class BlsVersion = bls_mss_ro_version,
337  template<typename> class BlsScheme = bls_basic_scheme,
338  typename CurveType = algebra::curves::bls12_381>
339  struct bls {
341  typedef BlsVersion<PublicParams, CurveType> bls_version_type;
342  typedef BlsScheme<bls_version_type> bls_scheme_type;
343 
348  };
349 
350  template<typename PublicParams, template<typename, typename> class BlsVersion,
351  template<typename> class BlsScheme, typename CurveType>
352  struct public_key<bls<PublicParams, BlsVersion, BlsScheme, CurveType>> {
355 
356  typedef typename bls_scheme_type::private_key_type private_key_type;
357  typedef typename bls_scheme_type::public_key_type public_key_type;
358  typedef typename bls_scheme_type::signature_type signature_type;
359 
360  typedef typename public_key_type::group_type public_key_group_type;
361  typedef typename signature_type::group_type signature_group_type;
362 
363  typedef typename bls_scheme_type::internal_accumulator_type internal_accumulator_type;
364 
366 
367  public_key() = delete;
369  }
370 
371  inline void init_accumulator(internal_accumulator_type &acc) const {
372  bls_scheme_type::init_accumulator(acc, pubkey);
373  }
374 
375  template<typename InputRange>
376  static inline void update(internal_accumulator_type &acc, const InputRange &range) {
377  bls_scheme_type::update(acc, range);
378  }
379 
380  template<typename InputIterator>
381  static inline void update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
382  bls_scheme_type::update(acc, first, last);
383  }
384 
385  inline bool verify(internal_accumulator_type &acc, const signature_type &sig) const {
386  return bls_scheme_type::verify(acc, pubkey, sig);
387  }
388 
390  return pubkey;
391  }
392 
393  // TODO: refactor pop
394  template<typename FakeAccumulator>
395  inline bool pop_verify(FakeAccumulator, const signature_type &proof) const {
396  return bls_scheme_type::pop_verify(pubkey, proof);
397  }
398 
399  // FIXME: copy pubkey between equivalent public keys is a bottleneck
400  // TODO: support using of the same pubkey even if scheme policy differs in public params and scheme type
401  template<typename ToPublicParams, template<typename> class ToBlsScheme>
404  }
405 
406  protected:
408  };
409 
410  template<typename PublicParams, template<typename, typename> class BlsVersion,
411  template<typename> class BlsScheme, typename CurveType>
412  struct private_key<bls<PublicParams, BlsVersion, BlsScheme, CurveType>>
413  : public public_key<bls<PublicParams, BlsVersion, BlsScheme, CurveType>> {
417 
418  typedef typename base_type::private_key_type private_key_type;
419  typedef typename base_type::public_key_type public_key_type;
420  typedef typename base_type::signature_type signature_type;
421 
422  typedef typename bls_scheme_type::internal_accumulator_type internal_accumulator_type;
423 
425 
426  private_key() = delete;
427  private_key(const key_type &privkey) :
428  privkey(privkey), base_type(bls_scheme_type::generate_public_key(privkey)) {
429  }
430 
431  inline void init_accumulator(internal_accumulator_type &acc) const {
432  bls_scheme_type::init_accumulator(acc, privkey);
433  }
434 
435  template<typename InputRange>
436  static inline void update(internal_accumulator_type &acc, const InputRange &range) {
437  bls_scheme_type::update(acc, range);
438  }
439 
440  template<typename InputIterator>
441  static inline void update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
442  bls_scheme_type::update(acc, first, last);
443  }
444 
446  return bls_scheme_type::sign(acc, privkey);
447  }
448 
449  inline signature_type pop_prove() const {
450  return bls_scheme_type::pop_prove(privkey);
451  }
452 
453  // FIXME: copy privkey between equivalent private keys is a bottleneck
454  // TODO: support using of the same privkey even if scheme policy differs in public params and scheme
455  // type
456  template<typename ToPublicParams, template<typename> class ToBlsScheme>
459  }
460 
461  protected:
463  };
464 
465  template<typename PublicParams, template<typename, typename> class BlsVersion,
466  template<typename> class BlsScheme, typename CurveType>
467  struct aggregate_op<bls<PublicParams, BlsVersion, BlsScheme, CurveType>> {
470 
471  typedef typename bls_scheme_type::private_key_type private_key_type;
472  typedef typename bls_scheme_type::public_key_type public_key_type;
473  typedef typename bls_scheme_type::signature_type signature_type;
474 
477 
478  static inline void init_accumulator(internal_accumulator_type &acc) {
479  acc = signature_type::zero();
480  }
481 
482  template<typename InputRange>
483  static inline void update(internal_accumulator_type &acc, const InputRange &range) {
484  bls_scheme_type::update_aggregate(acc, range);
485  }
486 
487  template<typename InputIterator>
488  static inline void update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
489  bls_scheme_type::update_aggregate(acc, first, last);
490  }
491 
493  return acc;
494  }
495  };
496 
497  template<typename PublicParams, template<typename, typename> class BlsVersion,
498  template<typename> class BlsScheme, typename CurveType>
499  struct aggregate_verify_op<bls<PublicParams, BlsVersion, BlsScheme, CurveType>> {
503 
504  typedef typename bls_scheme_type::private_key_type private_key_type;
505  typedef typename bls_scheme_type::public_key_type public_key_type;
506  typedef typename bls_scheme_type::signature_type signature_type;
507 
508  typedef typename bls_scheme_type::internal_accumulator_type _internal_accumulator_type;
509  typedef typename bls_scheme_type::internal_aggregation_accumulator_type
512  typedef bool result_type;
513 
514  static inline void init_accumulator(internal_accumulator_type &acc) {
515  }
516 
517  template<typename InputIterator>
518  static inline void update(internal_accumulator_type &acc, const scheme_public_key_type &scheme_pubkey,
519  InputIterator first, InputIterator last) {
520  auto index = get_public_key_index(acc, scheme_pubkey);
521  bls_scheme_type::update(acc.second[index], first, last);
522  }
523 
524  template<typename InputRange>
525  static inline void update(internal_accumulator_type &acc, const scheme_public_key_type &scheme_pubkey,
526  const InputRange &range) {
527  auto index = get_public_key_index(acc, scheme_pubkey);
528  bls_scheme_type::update(acc.second[index], range);
529  }
530 
532  return bls_scheme_type::aggregate_verify(acc, sig);
533  }
534 
535  private:
536  static inline std::size_t get_public_key_index(internal_accumulator_type &acc,
537  const scheme_public_key_type &scheme_pubkey) {
538  assert(std::distance(std::cbegin(acc.first), std::cend(acc.first)) ==
539  std::distance(std::cbegin(acc.second), std::cend(acc.second)));
540 
541  auto found_pos_it =
542  std::find(std::cbegin(acc.first), std::cend(acc.first), scheme_pubkey.public_key_data());
543 
544  if (std::cend(acc.first) == found_pos_it) {
545  acc.first.push_back(scheme_pubkey.public_key_data());
546  acc.second.push_back(_internal_accumulator_type());
547  bls_scheme_type::init_accumulator(acc.second.back(), acc.first.back());
548  return std::size(acc.first) - 1;
549  }
550 
551  return std::distance(std::cbegin(acc.first), found_pos_it);
552  }
553  };
554 
555  template<typename PublicParams, template<typename, typename> class BlsVersion, typename CurveType>
556  struct aggregate_verify_single_msg_op<bls<PublicParams, BlsVersion, bls_pop_scheme, CurveType>> {
560 
561  typedef typename bls_scheme_type::private_key_type private_key_type;
562  typedef typename bls_scheme_type::public_key_type public_key_type;
563  typedef typename bls_scheme_type::signature_type signature_type;
564 
565  typedef typename bls_scheme_type::internal_accumulator_type _internal_accumulator_type;
566  typedef typename bls_scheme_type::internal_fast_aggregation_accumulator_type
569  typedef bool result_type;
570 
571  static inline void init_accumulator(internal_accumulator_type &acc) {
572  }
573 
574  template<typename InputIterator>
575  static inline typename std::enable_if<!std::is_convertible<
576  typename std::iterator_traits<InputIterator>::value_type, scheme_public_key_type>::value>::type
577  update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
578  bls_scheme_type::update(acc.second, first, last);
579  }
580 
581  template<typename InputRange>
582  static inline typename std::enable_if<
583  !std::is_convertible<typename std::iterator_traits<typename InputRange::iterator>::value_type,
584  scheme_public_key_type>::value>::type
585  update(internal_accumulator_type &acc, const InputRange &range) {
586  bls_scheme_type::update(acc.second, range);
587  }
588 
589  template<typename InputIterator>
590  static inline typename std::enable_if<std::is_convertible<
591  typename std::iterator_traits<InputIterator>::value_type, scheme_public_key_type>::value>::type
592  update(internal_accumulator_type &acc, InputIterator first, InputIterator last) {
593  for (auto iter = first; iter != last; ++iter) {
594  update(acc, *iter);
595  }
596  }
597 
598  template<typename InputRange>
599  static inline typename std::enable_if<
600  std::is_convertible<typename std::iterator_traits<typename InputRange::iterator>::value_type,
601  scheme_public_key_type>::value>::type
602  update(internal_accumulator_type &acc, const InputRange &range) {
603  for (const auto &scheme_pubkey : range) {
604  update(acc, scheme_pubkey);
605  }
606  }
607 
608  static inline void update(internal_accumulator_type &acc, const scheme_public_key_type &scheme_pubkey) {
609  auto found_pos_it =
610  std::find(std::cbegin(acc.first), std::cend(acc.first), scheme_pubkey.public_key_data());
611  if (std::cend(acc.first) == found_pos_it) {
612  acc.first.push_back(scheme_pubkey.public_key_data());
613  }
614  }
615 
617  return bls_scheme_type::aggregate_verify(acc, sig);
618  }
619  };
620  } // namespace pubkey
621  } // namespace crypto3
622 } // namespace nil
623 
624 #endif // CRYPTO3_PUBKEY_BLS_HPP
A struct representing a BLS12-381 and BLS12-377 curve.
Definition: curves/bls12.hpp:49
UniformityCount
Definition: h2c_policy.hpp:32
ExpandMsgVariant
Definition: h2c_policy.hpp:34
OutputIterator verify(InputIterator first, InputIterator last, OutputIterator out)
Definition: mac/include/nil/crypto3/mac/algorithm/verify.hpp:50
boost::mpl::apply< AccumulatorSet, tag::sign< ProcessingMode > >::type::result_type sign(const AccumulatorSet &acc)
Definition: accumulators/sign.hpp:113
boost::mpl::apply< AccumulatorSet, tag::aggregate_verify< ProcessingMode > >::type::result_type aggregate_verify(const AccumulatorSet &acc)
Definition: accumulators/aggregate_verify.hpp:131
boost::mpl::apply< AccumulatorSet, tag::pubkey< ProcessingMode > >::type::result_type pubkey(const AccumulatorSet &acc)
Definition: accumulators/pubkey.hpp:106
boost::mpl::apply< AccumulatorSet, tag::aggregate< ProcessingMode > >::type::result_type aggregate(const AccumulatorSet &acc)
Definition: accumulators/aggregate.hpp:106
Definition: pair.hpp:31
static void update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:483
static void update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:488
bls_scheme_type::private_key_type private_key_type
Definition: bls.hpp:471
static void init_accumulator(internal_accumulator_type &acc)
Definition: bls.hpp:478
static result_type process(internal_accumulator_type &acc)
Definition: bls.hpp:492
bls< PublicParams, BlsVersion, BlsScheme, CurveType > scheme_type
Definition: bls.hpp:468
Definition: aggregate_op.hpp:33
_internal_aggregation_accumulator_type internal_accumulator_type
Definition: bls.hpp:511
static void update(internal_accumulator_type &acc, const scheme_public_key_type &scheme_pubkey, InputIterator first, InputIterator last)
Definition: bls.hpp:518
bls< PublicParams, BlsVersion, BlsScheme, CurveType > scheme_type
Definition: bls.hpp:500
static void init_accumulator(internal_accumulator_type &acc)
Definition: bls.hpp:514
static void update(internal_accumulator_type &acc, const scheme_public_key_type &scheme_pubkey, const InputRange &range)
Definition: bls.hpp:525
static result_type process(internal_accumulator_type &acc, const signature_type &sig)
Definition: bls.hpp:531
bls_scheme_type::internal_aggregation_accumulator_type _internal_aggregation_accumulator_type
Definition: bls.hpp:510
bls_scheme_type::internal_accumulator_type _internal_accumulator_type
Definition: bls.hpp:508
Definition: aggregate_verify_op.hpp:33
static std::enable_if<!std::is_convertible< typename std::iterator_traits< InputIterator >::value_type, scheme_public_key_type >::value >::type update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:577
static std::enable_if< std::is_convertible< typename std::iterator_traits< typename InputRange::iterator >::value_type, scheme_public_key_type >::value >::type update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:602
static std::enable_if< std::is_convertible< typename std::iterator_traits< InputIterator >::value_type, scheme_public_key_type >::value >::type update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:592
static void update(internal_accumulator_type &acc, const scheme_public_key_type &scheme_pubkey)
Definition: bls.hpp:608
static std::enable_if< !std::is_convertible< typename std::iterator_traits< typename InputRange::iterator >::value_type, scheme_public_key_type >::value >::type update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:585
static result_type process(internal_accumulator_type &acc, const signature_type &sig)
Definition: bls.hpp:616
bls< PublicParams, BlsVersion, bls_pop_scheme, CurveType > scheme_type
Definition: bls.hpp:557
bls_scheme_type::internal_fast_aggregation_accumulator_type _internal_fast_aggregation_accumulator_type
Definition: bls.hpp:567
Definition: aggregate_verify_single_msg_op.hpp:33
static void init_accumulator(internal_accumulator_type &acc, const private_key_type &privkey)
Definition: bls.hpp:149
basic_functions::private_key_type private_key_type
Definition: bls.hpp:137
static void init_accumulator(internal_accumulator_type &acc, const public_key_type &pubkey)
Definition: bls.hpp:153
signature_version::basic_functions basic_functions
Definition: bls.hpp:135
static bool aggregate_verify(internal_aggregation_accumulator_type &acc, const signature_type &signature)
Definition: bls.hpp:187
basic_functions::internal_accumulator_type internal_accumulator_type
Definition: bls.hpp:141
static void update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:163
basic_functions::signature_type signature_type
Definition: bls.hpp:139
static void update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:158
SignatureVersion signature_version
Definition: bls.hpp:134
static public_key_type generate_public_key(const private_key_type &privkey)
Definition: bls.hpp:145
static void update_aggregate(signature_type &acc, const SignatureRange &signatures)
Definition: bls.hpp:177
static bool verify(internal_accumulator_type &acc, const public_key_type &pubkey, const signature_type &sig)
Definition: bls.hpp:171
static void update_aggregate(signature_type &acc, SignatureIterator sig_first, SignatureIterator sig_last)
Definition: bls.hpp:182
basic_functions::public_key_type public_key_type
Definition: bls.hpp:138
basic_functions::internal_aggregation_accumulator_type internal_aggregation_accumulator_type
Definition: bls.hpp:143
static signature_type sign(internal_accumulator_type &acc, const private_key_type &privkey)
Definition: bls.hpp:167
Basic BLS Scheme.
Definition: bls.hpp:67
static void init_accumulator(internal_accumulator_type &acc, const public_key_type &pubkey)
Definition: bls.hpp:86
static public_key_type generate_public_key(const private_key_type &privkey)
Definition: bls.hpp:79
basic_functions::public_key_type public_key_type
Definition: bls.hpp:72
static void update_aggregate(signature_type &acc, SignatureIterator sig_first, SignatureIterator sig_last)
Definition: bls.hpp:114
static bool aggregate_verify(internal_aggregation_accumulator_type &acc, const signature_type &signature)
Definition: bls.hpp:119
SignatureVersion signature_version
Definition: bls.hpp:68
static void update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:90
static void update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:95
basic_functions::internal_aggregation_accumulator_type internal_aggregation_accumulator_type
Definition: bls.hpp:77
static void update_aggregate(signature_type &acc, const SignatureRange &signatures)
Definition: bls.hpp:109
static bool verify(internal_accumulator_type &acc, const public_key_type &pubkey, const signature_type &sig)
Definition: bls.hpp:103
signature_version::basic_functions basic_functions
Definition: bls.hpp:69
basic_functions::private_key_type private_key_type
Definition: bls.hpp:71
basic_functions::internal_accumulator_type internal_accumulator_type
Definition: bls.hpp:75
static void init_accumulator(internal_accumulator_type &acc, const private_key_type &privkey)
Definition: bls.hpp:83
basic_functions::signature_type signature_type
Definition: bls.hpp:73
static signature_type sign(internal_accumulator_type &acc, const private_key_type &privkey)
Definition: bls.hpp:99
std::array< std::uint8_t, 43 > dst_type
Definition: bls.hpp:300
constexpr static hashes::ExpandMsgVariant expand_msg_variant
Definition: bls.hpp:297
constexpr static hashes::UniformityCount uniformity_count
Definition: bls.hpp:296
static constexpr dst_type dst
Definition: bls.hpp:301
detail::bls_basic_functions< policy_type > basic_functions
Definition: bls.hpp:290
detail::bls_mps_ro_policy< PublicParams, CurveType > policy_type
Definition: bls.hpp:289
detail::bls_basic_functions< policy_type > basic_functions
Definition: bls.hpp:280
detail::bls_mss_ro_policy< PublicParams, CurveType > policy_type
Definition: bls.hpp:279
constexpr static hashes::ExpandMsgVariant expand_msg_variant
Definition: bls.hpp:311
constexpr static hashes::UniformityCount uniformity_count
Definition: bls.hpp:310
static dst_type dst
Definition: bls.hpp:314
std::vector< std::uint8_t > dst_type
Definition: bls.hpp:313
Proof of possession BLS Scheme.
Definition: bls.hpp:200
static void init_accumulator(internal_accumulator_type &acc, const private_key_type &privkey)
Definition: bls.hpp:218
basic_functions::internal_fast_aggregation_accumulator_type internal_fast_aggregation_accumulator_type
Definition: bls.hpp:212
SignatureVersion signature_version
Definition: bls.hpp:201
basic_functions::internal_accumulator_type internal_accumulator_type
Definition: bls.hpp:208
static signature_type pop_prove(const private_key_type &privkey)
Definition: bls.hpp:264
signature_version::basic_functions basic_functions
Definition: bls.hpp:202
static bool aggregate_verify(internal_fast_aggregation_accumulator_type &acc, const signature_type &signature)
Definition: bls.hpp:259
static public_key_type generate_public_key(const private_key_type &privkey)
Definition: bls.hpp:214
static signature_type sign(internal_accumulator_type &acc, const private_key_type &privkey)
Definition: bls.hpp:234
basic_functions::signature_type signature_type
Definition: bls.hpp:206
static bool aggregate_verify(internal_aggregation_accumulator_type &acc, const signature_type &signature)
Definition: bls.hpp:254
basic_functions::internal_aggregation_accumulator_type internal_aggregation_accumulator_type
Definition: bls.hpp:210
static bool verify(internal_accumulator_type &acc, const public_key_type &pubkey, const signature_type &sig)
Definition: bls.hpp:238
static void update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:225
static void update_aggregate(signature_type &acc, SignatureIterator sig_first, SignatureIterator sig_last)
Definition: bls.hpp:249
static void update_aggregate(signature_type &acc, const SignatureRange &signatures)
Definition: bls.hpp:244
basic_functions::private_key_type private_key_type
Definition: bls.hpp:204
static void init_accumulator(internal_accumulator_type &acc, const public_key_type &pubkey)
Definition: bls.hpp:221
basic_functions::public_key_type public_key_type
Definition: bls.hpp:205
static bool pop_verify(const public_key_type &pubkey, const signature_type &proof)
Definition: bls.hpp:268
static void update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:230
std::vector< std::uint8_t > dst_type
Definition: bls.hpp:327
constexpr static hashes::ExpandMsgVariant expand_msg_variant
Definition: bls.hpp:325
constexpr static hashes::UniformityCount uniformity_count
Definition: bls.hpp:324
static dst_type dst
Definition: bls.hpp:328
Definition: bls.hpp:339
BlsVersion< PublicParams, CurveType > bls_version_type
Definition: bls.hpp:341
private_key< self_type > private_key_type
Definition: bls.hpp:345
public_key< self_type > public_key_type
Definition: bls.hpp:344
aggregate_op< self_type > aggregate_op_policy
Definition: bls.hpp:346
aggregate_verify_op< self_type > aggregate_verify_op_policy
Definition: bls.hpp:347
bls< PublicParams, BlsVersion, BlsScheme, CurveType > self_type
Definition: bls.hpp:340
BlsScheme< bls_version_type > bls_scheme_type
Definition: bls.hpp:342
Definition: bls_basic_functions.hpp:52
Definition: bls_basic_policy.hpp:95
Definition: bls_basic_policy.hpp:59
signature_type sign(internal_accumulator_type &acc) const
Definition: bls.hpp:445
bls< PublicParams, BlsVersion, BlsScheme, CurveType > scheme_type
Definition: bls.hpp:414
bls_scheme_type::internal_accumulator_type internal_accumulator_type
Definition: bls.hpp:422
static void update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:441
static void update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:436
void init_accumulator(internal_accumulator_type &acc) const
Definition: bls.hpp:431
Private key - a key known only to its owner. Only the user keeping his private key secret guarantees ...
Definition: private_key.hpp:47
bls< PublicParams, BlsVersion, BlsScheme, CurveType > scheme_type
Definition: bls.hpp:353
bls_scheme_type::private_key_type private_key_type
Definition: bls.hpp:356
void init_accumulator(internal_accumulator_type &acc) const
Definition: bls.hpp:371
bls_scheme_type::public_key_type public_key_type
Definition: bls.hpp:357
bool pop_verify(FakeAccumulator, const signature_type &proof) const
Definition: bls.hpp:395
bool verify(internal_accumulator_type &acc, const signature_type &sig) const
Definition: bls.hpp:385
bls_scheme_type::internal_accumulator_type internal_accumulator_type
Definition: bls.hpp:363
static void update(internal_accumulator_type &acc, InputIterator first, InputIterator last)
Definition: bls.hpp:381
static void update(internal_accumulator_type &acc, const InputRange &range)
Definition: bls.hpp:376
Public key - a key that can be published and used to verify the authenticity of the signed document,...
Definition: public_key.hpp:43