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 執行結果:
    <br/>leeTest------>: 1 ---------------------------------------
    <br/>leeTest------>: privateKey = 128B2FA8BD433C6C068C8D803DFF79792A519A55171B1B650C23661D15897263
    <br/>leeTest------>: pubkey = 040AE4C7798AA0F119471BEE11825BE46202BB79E2A5844495E97C04FF4DF2548A7C0240F88F1CD4E16352A73C17B7F16F07353E53A176D684A9FE0C6BB798E857
    <br/>leeTest------>: userId = [email protected]
    <br/>leeTest------>: after privateKey sign, result = 304402206E0266508466EEB68C4E50D1D823101C405EEF3295859BD160811E0E455FF53002205372010CC62B1D73341982906D99EAAC4A1472618150F4D690B4D92B8BA41B0D
    <br/>leeTest------>: user pubkey verifyResult = true
    <br/>leeTest------>: 2 ---------------------------------------
    <br/>leeTest------>: cipherText = 307202203DF61DE93F19AA4547DF343BD1C369CE4062C2F523FC1F111945EF1952CAD72202200245B30B374D0ECB3FB140DBEB01BB66D307A7B2254CD74E4C1602701A504CFA0420AD353782C492BE55041B394B7CB2DB8BFC664E2F6F2C78DA1B726BA83A424463040AEE6592603C35E9891EA9
    <br/>leeTest------>: plainText = HelloWorld
    <br/>leeTest------>: End ---------------------------------------
3 文章來自於
    http://blog.csdn.net/moonshine99/article/details/79426665

.