椭圆曲线加密算法SM2在Android用Java调用实现

        SM2基于ECC,ECC(Elliptic Curves Cryptography)加密算法是一种公钥加密算法,与主流的RSA算法相比,ECC算法可以使用较短的密钥达到相同的安全程度。近年来,人们对ECC的认识已经不再处于研究阶段,开始逐步进入实际应用,如国家密码管理局颁布的SM2算法就是基于ECC算法的。


  demo下载:  https://github.com/HungryGoogle/SM2_Demo_replace_RSA/tree/master

1 调用函数
    SM2Utils.testSm2();
    
2 运行结果:
    
leeTest------>: 1 ---------------------------------------

leeTest------>: privateKey = 128B2FA8BD433C6C068C8D803DFF79792A519A55171B1B650C23661D15897263

leeTest------>: pubkey = 040AE4C7798AA0F119471BEE11825BE46202BB79E2A5844495E97C04FF4DF2548A7C0240F88F1CD4E16352A73C17B7F16F07353E53A176D684A9FE0C6BB798E857

leeTest------>: userId = [email protected]

leeTest------>: after privateKey sign, result = 304402206E0266508466EEB68C4E50D1D823101C405EEF3295859BD160811E0E455FF53002205372010CC62B1D73341982906D99EAAC4A1472618150F4D690B4D92B8BA41B0D

leeTest------>: user pubkey verifyResult = true

leeTest------>: 2 ---------------------------------------

leeTest------>: cipherText = 307202203DF61DE93F19AA4547DF343BD1C369CE4062C2F523FC1F111945EF1952CAD72202200245B30B374D0ECB3FB140DBEB01BB66D307A7B2254CD74E4C1602701A504CFA0420AD353782C492BE55041B394B7CB2DB8BFC664E2F6F2C78DA1B726BA83A424463040AEE6592603C35E9891EA9

leeTest------>: plainText = HelloWorld

leeTest------>: End ---------------------------------------
3 文章来自于 http://blog.csdn.net/moonshine99/article/details/79426665

你可能感兴趣的:(Android)