摘要
随着近年来Web应用的大量普及及其安全问题的频发,用JavaScript进行一些密码运算的需求也随之而来.相比传统外插硬件外加驱动的密码计算模式,用JavaScript实现密码算法具有跨平台、免安装、兼容性好的优点.我们基于一款用JavaScript编写的国际密码算法库,加入了国密SM2、SM3和SM4算法,并使用固定基的comb方法对椭圆曲线固定点的标量乘进行了优化,使密钥生成和签名速度提升了一倍以上.在保证运算速度的同时,我们也尽量保持了代码量的最小化,以减小流量消耗和下载时长.我们在Chrome、Firefox、Opera和Maxthon浏览器中进行了验证和性能评估,在Firefox上,SM2签名算法性能达到了每秒生成100对密钥,签名95次,验签40次,SM3算法速度达到了69.75 Mbps,SM4算法速度达到了110.97 Mbps.
With the popularity of Web applications and their frequent occurrence of security problems in recent years,JavaScript becomes very useful for some cryptographic computations.Compared with the traditional pluggable-hardware&driver mode for cryptographic computation,implementation of cryptographic algorithms with JavaScript has many advantages,such as cross-platform compatibility and installation-free.We implemented the national standard encryption algorithms SM2,SM3 and SM4 based on a JavaScript-programed cryptography library for international encryption algorithms.In addition,we took advantage of the fixed-base comb method to optimize the fixed-point scalarmultiplication of elliptic curve cryptographic algorithm,thus achieved more than double-speed of key generation and signature generation than before.Without losing the library’s runtime performance,we tried to minimize the code size,so as to reduce the network traffic consumption and the transmission latency.Experiments were carried out in Chrome,Firefox,Opera and Maxthon browsers.In Firefox,SM2 signature algorithm generated 100 pairs of keys,and finished 95 operations of signature generation and 40 operations of signature verification per second.The speed of SM3 and SM4 algorithm can reach69.75 Mbps and 110.97 Mbps,respectively.
作者
魏荣
郑昉昱
林璟锵
WEI Rong;ZHENG Fang-Yu;LIN Jing-Qiang(State Key Laboratory of Information Security,Institute of Information Engineering,Chinese Academy of Sciences,Beijing 100093,China;Data Assurance and Communications Security Research Center,Chinese Academy of Sciences,Beijing 100093,China;School of Cyber Security,University of Chinese Academy of Sciences,Beijing 100049,China;School of Cyber Security,University of Science and Technology of China,Hefei 230026,China)
出处
《密码学报》
CSCD
2020年第5期595-604,共10页
Journal of Cryptologic Research
基金
国家重点研发计划(2017YFB0802100)
国家自然科学基金(61772518)。
关键词
WEB应用
JAVASCRIPT
国密算法
标量乘
密码库
web application
JavaScript
domestic cryptographic algorithm
scalar-multiplication
cryptography library