您的位置:首页 > 运维架构

snooper taoism 2 中 sm2 辅助计算脚本

2011-08-10 11:45 309 查看
static static_prompt = "sm2(临时版)" position = 0% width = 100% height = 1
crlf

static static_sm2_private_key = "private key" position = 0% width = 100% height = 1
crlf

edit sm2_private_key filename = "sm2_private_key" position = 0% width = 60% height = 2
crlf

static static_sm2_public_key = "public key" position = 0% width = 100% height = 1
crlf

edit sm2_public_key filename = "sm2_public_key" position = 0% width = 60% height = 2
button sm2_generate_keypair = "sm2_generate_keypair" position = 61% width = 40% height = 1
crlf

static static_0001 = "---------------------------------" position = 0% width = 100% height = 1
crlf

static static_sm2_hash = "hash result ( must non zero )" position = 0% width = 100% height = 1
crlf
edit sm2_hash filename = "sm2_hash" position = 0% width = 100% height = 2
crlf

static static_sm2_sign_r = "R" position = 0% width = 49% height = 1
static static_sm2_sign_s = "S" position = 50% width = 49% height = 1
crlf
edit sm2_sign_r filename = "sm2_sign_r" position = 0% width = 49% height = 2
edit sm2_sign_s filename = "sm2_sign_s" position = 50% width = 49% height = 2
crlf

static static_sm2_sign_result = "verify result (00 success, other failure)" position = 0% width = 100% height = 1
crlf
edit sm2_sign_verify_result filename = "sm2_sign_verify_result" position = 0% width = 100% height = 1
crlf

button sm2_sign = "sm2_sign" position = 0% width = 40% height = 1
button sm2_sign_verify = "sm2_sign_verify" positiont= 50^ width = 40% height = 1
crlf

static static_0002 = "---------------------------------" position = 0% width = 100% height = 1
crlf

static static_sm2_input = "input" position = 0% width = 100% height = 1
crlf
edit sm2_input filename = "sm2_input" position = 0% width = 100% height = 2
crlf

static static_sm2_output = "output" position = 0% width = 100% height = 1
button swap_input_output = "swap input output" position = 51% width = 49% height = 1
crlf
edit sm2_output filename = "sm2_output" position = 0% width = 100% height = 2
crlf

button sm2_pub_encode = "sm2_pub_encode" position = 0% width = 40% height = 1
button sm2_pri_decode = "sm2_pri_decode" positiont= 50^ width = 40% height = 1
crlf

static static_0003 = "------------ use sm2 key run ecc dh -----------" position = 0% width = 100% height = 1
crlf

static static_sm2_dh_prikey1 = "sm2 private key1" position = 0% width = 49% height = 1
static static_sm2_dh_pubkey2 = "sm2 public  key2" position = 50% width = 49% height = 1
crlf
edit sm2_dh_prikey1 filename = "sm2_dh_prikey1" position = 0% width = 49% height = 2
edit sm2_dh_pubkey2 filename = "sm2_dh_pubkey2" position = 50% width = 49% height = 2
crlf
static static_sm2_dh_result = "ecc dh result" position = 0% width = 49% height = 1
crlf
edit sm2_dh_result filename = "ecc_ch_result" position = 0% width = 100% height = 2
crlf
button sm2_ecc_dh = "sm2_ecc_dh" position = 30% width = 40% height = 1
crlf

function sm2_ecc_dh
    sm2_dh_result = sm2_ecc_dh( $sm2_dh_prikey1, $sm2_dh_pubkey2 )
end function

function sm2_generate_keypair
    null = clear_fifo()
    null = sm2_generate_keypair()
    sm2_public_key = read_fifo()
    sm2_private_key = read_fifo()
end function

function sm2_sign
    null = clear_fifo()
    null = sm2_sign( $sm2_private_key, $sm2_hash )
    sm2_sign_r = read_fifo()
    sm2_sign_s = read_fifo()
end function

function sm2_sign_verify
    sm2_sign_verify_result = sm2_sign_verify( $sm2_public_key, $sm2_hash, $sm2_sign_r, $sm2_sign_s )
end function

function sm2_pub_encode
    sm2_output = sm2_pub_encode( $sm2_input, $sm2_public_key )
end function

function sm2_pri_decode
    sm2_output = sm2_pri_decode( $sm2_input, $sm2_private_key )
end function

function swap_input_output
    null = clear_fifo()
    null = write_fifo( $sm2_input )
    null = write_fifo( $sm2_output )
    sm2_output = read_fifo()
    sm2_input = read_fifo()
end function
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  output input null 脚本