Page 295 - 《软件学报》2021年第11期
P. 295

王利朋  等:应用区块链的多接收者多消息签密方案                                                        3621


                    算法 1.  密钥更新策略 updateStrategy.
                    输入:开始执行同步的时刻 start_timestamp,更新周期 period.
                    输出:执行结果(TRUE/FALSE).
                    1.   blockHeight=eth.getblockNumber(⋅);
                    2.   current_timestamp=eth.getTimestamp(blockHeight);
                    3.   if (current_timestamp≥start_timestamp)
                    4.      return FALSE;
                    5.   while (is_exit(⋅)){
                    6.      sleep(1);
                    7.      blockHeight=eth.getblockNumber(⋅);
                    8.      current_timestamp=eth.getTimestamp(blockHeight);
                    9.      if (start_timestamp≥current_timestamp)
                    10.        start_timestamp=current_timestamp;
                    11.        break;
                    12. }
                    13. do {
                    14.     blockHeight=eth.getblockNumber(⋅);
                    15.     current_timestamp=eth.getTimestamp(blockHeight);
                    16.     if (current_timestamp−start_timestamp>min(period,30))
                    17.        sleep(min(period,30)/2);
                    18.     else
                    19.        sleep(1);
                    20.     if (current_timestamp≥start_timestamp+period){
                    21.        UpdateKey(⋅);
                    22.    }
                    23. } while (is_exit(⋅));
                    24. return TRUE;
                    UPDATE STRATEGY 算法执行流程描述.
                    1.   获取当前最新区块对应的时间戳,判断是否要早于开始执行同步的时刻:如果否,则退出程序.
                    2.   等待一定时间,直到当前最新区块对应的时间戳等于或晚于开始执行同步的时刻.
                    3.   等待 period 秒,然后执行密钥更新操作 UpdateKey(⋅).为了减少访问区块链的次数,这里设定:如果距离
                        更新的时间大于 min(period,30),则执行睡眠的时间为 min(period,30)/2.

                 8    仿真实验

                 8.1   签密方案性能分析
                    本文椭圆曲线参数设置参考 Secp256k1.Secp256k1 是经优化的基于有限域F p 的椭圆曲线,与其他曲线相比,

                 其性能能够提升 30%左右       [30] .由于其密钥长度较短,故占用较小的存储和带宽资源.实验环境的具体配置如下.
                    •   CPU: Intel(R) Core(TM) i5-7500 3.40GHz;
                    •   RAM: 8.00GB;
                    •   磁盘: 128GB SSD+1TB SATA;
                    •   OS: Windows 7 64.
   290   291   292   293   294   295   296   297   298   299   300