Categorygithub.com/FairBlock/DistributedIBE
repositorypackage
0.0.0-20231211202607-d457df6869db
Repository: https://github.com/fairblock/distributedibe.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

DistributedIBE

This library implements the Threshold IBE scheme based on Boneh-Franklin scheme.

Security Parameters

This scheme relies on the hybrid encryption. We use the implementation of such scheme by FiloSottile/age which only encrypts a random symmetric key that is used to encrypt the data using Chacha20Poly1305.

The used symmetric key is of size 32 bytes. The implementation of IBE scheme used to encrypt this key uses the BLS12-381 curve.

Benchmarking Results

We have tested the efficiency of our scheme against the number of validators and message size.

The below table shows the runtime of the scheme covering share generation, key extraction, commitment verification, message encryption, key aggregation, and ciphertext decryption through different numbers of validators:

Number of ValidatorsExecution Time
410880689 ns/op
819333171 ns/op
1636199305 ns/op
3270639750 ns/op
64144968458 ns/op
128290355378 ns/op

Based on the above table, we can clearly see that the executrion time increases linearly with the number of validators.

Since the message is being encrypted first and the key is used for the IBE, we expect the execution time to be independent of the message size. The microbenchmarking results confirm this as shown in the below table:

Message Size (bytes)Execution Time
811180636 ns/op
3211006738 ns/op
12811160579 ns/op
51210927982 ns/op
204810927359 ns/op
819211029081 ns/op

We also broke down the steps to measure the overhead of each stage:

FunctionNumber of ValidatorsExecution Time
Key extraction and aggregation128213753903 ns/op
FunctionNumber of messagesExecution Time
Encryption11574796 ns/op
46179149 ns/op
1624764695 ns/op
64100275889 ns/op
256399253311 ns/op
Decryption87205781 ns/op
3230806709 ns/op
128117187771 ns/op
512457499724 ns/op
1024930084488 ns/op

In order to improve the efficiency in case of decrypting large number of messages, we can perform the decryption in parallel. Below shows the execution times for the parallel decryption:

FunctionNumber of messagesExecution Time
Decryption82404587 ns/op
326470264 ns/op
12823466097 ns/op
51280075636 ns/op
1024153275583 ns/op

All benchmarks have been ran on a laptop with 12th Gen Intel(R) Core(TM) i7-1270P cpu.

KZG Commitments vs VSS

Below, we compare the verification time for KZG commitments vs VSS.

FunctionNumber of ValidatorsExecution Time
KZG Share Verification44744239 ns/op
89348084 ns/op
1618922709 ns/op
3238153229 ns/op
6477705447 ns/op
128154309057 ns/op
VSS Share Verification4383691 ns/op
81521771 ns/op
167168398 ns/op
3238691278 ns/op
64219296811 ns/op
1281039926768 ns/op
KZG Share Generation4641104 ns/op
82612382 ns/op
1611231675 ns/op
3252606951 ns/op
64260647892 ns/op
1281075045566 ns/op
VSS Share Generation4191175 ns/op
8332393 ns/op
16610982 ns/op
321264965 ns/op
642662454 ns/op
1287105321 ns/op

Configuration

The following commands install the required packages and dependancies:

go mod init DistributedIBE
go mod tidy

Testing

Use the following commands to run the sample test:

cd DistributedIBE
go test

Use the below commands to run the benchmarks:

cd DistributedIBE
go test --bench=.