1157 lines
54 KiB
HTML
1157 lines
54 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
<title>SFK测试</title>
|
||
<link rel='stylesheet' href="../css/styles.css" />
|
||
<script type="text/javascript" src="../fiseckey.js"></script>
|
||
<script language="JavaScript">
|
||
var dev = 0;
|
||
var app = 0;
|
||
var con = 0;
|
||
var conname = 0;
|
||
var sessionkey = 0;
|
||
var mac = 0;
|
||
var hash = 0;
|
||
var flag = 0;
|
||
|
||
function PrintInfo(info) {
|
||
deviceManagerText.value = deviceManagerText.value + info + "\r\n";
|
||
document.getElementById("deviceManagerText").scrollTop = document.getElementById("deviceManagerText").scrollHeight;
|
||
}
|
||
function clearconsole() {
|
||
deviceManagerText.value = "";
|
||
document.getElementById("deviceManagerText").scrollTop = document.getElementById("deviceManagerText").scrollHeight;
|
||
}
|
||
|
||
function seturl(dev,app,con,conname) {
|
||
document.getElementById("indexhtml").href="../index.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
document.getElementById("devhtml").href="./devicemanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
document.getElementById("authhtml").href="./authmanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
document.getElementById("apphtml").href="./appmanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
document.getElementById("filehtml").href="./filemanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
document.getElementById("containerhtml").href="./containermanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
document.getElementById("servicehtml").href="./service.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
||
flag = 1;
|
||
}
|
||
|
||
function decodeurl() {
|
||
var url = window.location.href;
|
||
var tmp = url.split('?');
|
||
var param = tmp[1].split('&');
|
||
dev = param[0].split('=')[1];
|
||
app = param[1].split('=')[1];
|
||
con = param[2].split('=')[1];
|
||
conname = param[3].split('=')[1];
|
||
|
||
if(conname != 0){
|
||
Service.rsaContainer.value = conname;
|
||
Service.eccContainer.value = conname;
|
||
}else{
|
||
Service.rsaContainer.value = "";
|
||
Service.eccContainer.value = "";
|
||
}
|
||
}
|
||
|
||
window.onload=function() {
|
||
if(flag != 1)
|
||
decodeurl();
|
||
seturl(dev,app,con,conname);
|
||
}
|
||
|
||
function reload() {
|
||
if(flag != 1)
|
||
decodeurl();
|
||
seturl(dev,app,con,conname);
|
||
}
|
||
|
||
//nav-Service
|
||
function navsym() {
|
||
document.getElementById("sym-content").style.display="block";
|
||
document.getElementById("hash-content").style.display="none";
|
||
document.getElementById("rsa-content").style.display="none";
|
||
document.getElementById("ecc-content").style.display="none";
|
||
document.getElementById("mac-content").style.display="none";
|
||
document.getElementById("handle-content").style.display="none";
|
||
}
|
||
function navhash() {
|
||
document.getElementById("sym-content").style.display="none";
|
||
document.getElementById("hash-content").style.display="block";
|
||
document.getElementById("rsa-content").style.display="none";
|
||
document.getElementById("ecc-content").style.display="none";
|
||
document.getElementById("mac-content").style.display="none";
|
||
document.getElementById("handle-content").style.display="none";
|
||
}
|
||
function navrsa() {
|
||
document.getElementById("sym-content").style.display="none";
|
||
document.getElementById("hash-content").style.display="none";
|
||
document.getElementById("rsa-content").style.display="block";
|
||
document.getElementById("ecc-content").style.display="none";
|
||
document.getElementById("mac-content").style.display="none";
|
||
document.getElementById("handle-content").style.display="none";
|
||
}
|
||
function navecc() {
|
||
document.getElementById("sym-content").style.display="none";
|
||
document.getElementById("hash-content").style.display="none";
|
||
document.getElementById("rsa-content").style.display="none";
|
||
document.getElementById("ecc-content").style.display="block";
|
||
document.getElementById("mac-content").style.display="none";
|
||
document.getElementById("handle-content").style.display="none";
|
||
}
|
||
function navmac() {
|
||
document.getElementById("sym-content").style.display="none";
|
||
document.getElementById("hash-content").style.display="none";
|
||
document.getElementById("rsa-content").style.display="none";
|
||
document.getElementById("ecc-content").style.display="none";
|
||
document.getElementById("mac-content").style.display="block";
|
||
document.getElementById("handle-content").style.display="none";
|
||
}
|
||
function navclose() {
|
||
document.getElementById("sym-content").style.display="none";
|
||
document.getElementById("hash-content").style.display="none";
|
||
document.getElementById("rsa-content").style.display="none";
|
||
document.getElementById("ecc-content").style.display="none";
|
||
document.getElementById("mac-content").style.display="none";
|
||
document.getElementById("handle-content").style.display="block";
|
||
}
|
||
|
||
|
||
//function
|
||
function GenRandom() {
|
||
try {
|
||
var ramdomlen = Service.randomLen.value;
|
||
var result = SKFKEY.SKF_GenRandom(dev, ramdomlen);
|
||
PrintInfo(result);
|
||
}
|
||
catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function SetSymmKey() {
|
||
try {
|
||
var symkey = Service.sessionKey.value;
|
||
var symalg = Service.sessionKeyType.value;
|
||
var result = SKFKEY.SKF_SetSymmKey(dev, symkey, symalg);
|
||
sessionkey = result;
|
||
PrintInfo(result);
|
||
}
|
||
catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ImportSessionKey() {
|
||
try {
|
||
var symkey = Service.sessionKey.value;
|
||
var symalg = Service.sessionKeyType.value;
|
||
var result = SKFKEY.SKF_ImportSessionKey(con, symalg, symkey);
|
||
sessionkey = result;
|
||
PrintInfo(result);
|
||
}
|
||
catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function EncryptInit() {
|
||
try{
|
||
var iv = Service.symiv.value;
|
||
var padtype = Service.sympaddingType.value;
|
||
var feedlen = 0;//仅用于OFB,CFB模式,其他模式传0
|
||
var result = SKFKEY.SKF_EncryptInit(sessionkey,iv,padtype,feedlen);
|
||
if(result == 0)
|
||
PrintInfo("初始化加密成功");
|
||
else
|
||
PrintInfo("初始化加密失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function Encrypt() {
|
||
try{
|
||
var data = Service.symOrigin.value;
|
||
var result = SKFKEY.SKF_Encrypt(sessionkey,data);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function EncryptUpdate() {
|
||
try{
|
||
var data = Service.symOrigin.value;
|
||
var result = SKFKEY.SKF_EncryptUpdate(sessionkey,data);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function EncryptFinal() {
|
||
try{
|
||
var result = SKFKEY.SKF_EncryptFinal(sessionkey);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function DecryptInit() {
|
||
try{
|
||
var iv = Service.symiv.value;
|
||
var padtype = Service.sympaddingType.value;
|
||
var feedlen = 0;//仅用于OFB,CFB模式,其他模式传0
|
||
var result = SKFKEY.SKF_DecryptInit(sessionkey,iv,padtype,feedlen);
|
||
if(result == 0)
|
||
PrintInfo("初始化解密成功");
|
||
else
|
||
PrintInfo("初始化解密失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function Decrypt() {
|
||
try{
|
||
var data = Service.symOrigin.value;
|
||
var result = SKFKEY.SKF_Decrypt(sessionkey,data);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function DecryptUpdate() {
|
||
try{
|
||
var data = Service.symOrigin.value;
|
||
var result = SKFKEY.SKF_DecryptUpdate(sessionkey,data);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function DecryptFinal() {
|
||
try{
|
||
var result = SKFKEY.SKF_DecryptFinal(sessionkey);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function GenECCKeyPair() {
|
||
try{
|
||
var algflag = 131328;//只支持SGD_SM2_1算法
|
||
var result = SKFKEY.SKF_GenECCKeyPair(con, algflag);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ImportECCKeyPair() {
|
||
try{
|
||
var envelopeData = Service.eccEncryptKey.value;
|
||
var result = SKFKEY.SKF_ImportECCKeyPair(con, envelopeData);
|
||
if(result == 0)
|
||
PrintInfo("导入成功");
|
||
else
|
||
PrintInfo("导入失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ECCSignData() {
|
||
try{
|
||
var signData = Service.eccData.value;
|
||
var result = SKFKEY.SKF_ECCSignData(con, signData);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ECCVerify() {
|
||
try{
|
||
var origindata = Service.eccData.value;
|
||
var signData = Service.eccDataSign.value;
|
||
var pubkey = Service.eccDataPubkey.value;
|
||
var result = SKFKEY.SKF_ECCVerify(dev, pubkey, origindata, signData);
|
||
if(result == 0)
|
||
PrintInfo("验签成功");
|
||
else
|
||
PrintInfo("验签失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ECCExportSessionKey() {
|
||
try{
|
||
var alg = Service.ECCsessionKeyType.value;
|
||
var pubkey = Service.eccSessionPub.value;
|
||
var result = SKFKEY.SKF_ECCExportSessionKey(con, alg, pubkey);
|
||
PrintInfo(JSON.stringify(result));
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ExtECCEncrypt() {
|
||
try{
|
||
var indata = Service.eccDataOut.value;
|
||
var pubkey = Service.eccKeyOut.value;
|
||
var result = SKFKEY.SKF_ExtECCEncrypt(dev, pubkey, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ExtECCDecrypt() {
|
||
try{
|
||
var indata = Service.eccDataOut.value;
|
||
var prikey = Service.eccKeyOut.value;
|
||
var result = SKFKEY.SKF_ExtECCDecrypt(dev, prikey, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ExtECCSign() {
|
||
try{
|
||
var indata = Service.eccDataOut.value;
|
||
var prikey = Service.eccKeyOut.value;
|
||
var result = SKFKEY.SKF_ExtECCSign(dev, prikey, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ExtECCVerify() {
|
||
try{
|
||
var indata = Service.eccDataOut.value;
|
||
var signdata = Service.eccSignDataOut.value;
|
||
var pubkey = Service.eccKeyOut.value;
|
||
var result = SKFKEY.SKF_ExtECCVerify(dev, pubkey, indata, signdata);
|
||
if(result == 0)
|
||
PrintInfo("验签成功");
|
||
else
|
||
PrintInfo("验签失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ECCExportPublicKey() {
|
||
try{
|
||
var alg = Service.eccpubkeyType.value;
|
||
var result = SKFKEY.SKF_ExportPublicKey(con, alg);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function DigestInit() {
|
||
try{
|
||
var alg = Service.hashkey.value;
|
||
var pubkey = Service.hashpub.value;
|
||
var id = Service.hashid.value;
|
||
var result = SKFKEY.SKF_DigestInit(dev, alg, pubkey, id);
|
||
hash = result;
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function Digest() {
|
||
try{
|
||
var indata = Service.hashOrigin.value;
|
||
var result = SKFKEY.SKF_Digest(hash, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function DigestUpdate() {
|
||
try{
|
||
var indata = Service.hashOrigin.value;
|
||
var result = SKFKEY.SKF_DigestUpdate(hash, indata);
|
||
if(result == 0)
|
||
PrintInfo("多包hash更新成功");
|
||
else
|
||
PrintInfo("多包hash更新失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function DigestFinal() {
|
||
try{
|
||
var result = SKFKEY.SKF_DigestFinal(hash);
|
||
hash = 0;
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function MacInit() {
|
||
try{
|
||
var iv = Service.maciv.value;
|
||
var padding = Service.macpaddingType.value;
|
||
var feedlen = 0;
|
||
var result = SKFKEY.SKF_MacInit(sessionkey, iv, padding, feedlen);
|
||
mac = result;
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function Mac() {
|
||
try{
|
||
var indata = Service.macOrigin.value;
|
||
var result = SKFKEY.SKF_Mac(mac, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function MacUpdate() {
|
||
try{
|
||
var indata = Service.macOrigin.value;
|
||
var result = SKFKEY.MacUpdate(mac, indata);
|
||
if(result == 0)
|
||
PrintInfo("多包MAC更新成功");
|
||
else
|
||
PrintInfo("多包MAC更新失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function MacFinal() {
|
||
try{
|
||
var result = SKFKEY.SKF_MacFinal(mac);
|
||
mac = 0;
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function CloseHandle() {
|
||
try{
|
||
var closehan = Service.closehandle.value;
|
||
var result = SKFKEY.SKF_CloseHandle(closehan);
|
||
mac = 0;
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function GenExtRSAKey() {
|
||
try{
|
||
var bitlen = Service.extbitlen.value;
|
||
var result = SKFKEY.SKF_GenExtRSAKey(dev,bitlen);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function GenRSAKeyPair() {
|
||
try{
|
||
var bitlen = Service.extbitlen.value;
|
||
var result = SKFKEY.SKF_GenRSAKeyPair(con,bitlen);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function RSAExportPublicKey() {
|
||
try{
|
||
var alg = Service.rsapubkeyType.value;
|
||
var result = SKFKEY.SKF_ExportPublicKey(con, alg);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ImportRSAKeyPair() {
|
||
try{
|
||
var alg = Service.rsaimpType.value;
|
||
var warppedKey = Service.rsasymkey.value;
|
||
var encryptedData = Service.rsaEncryptKey.value;
|
||
var result = SKFKEY.SKF_ImportRSAKeyPair(con, alg, warppedKey, encryptedData);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function RSASignData() {
|
||
try{
|
||
var origin = Service.rsaData.value;
|
||
var result = SKFKEY.SKF_RSASignData(con, origin);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function RSAVerify() {
|
||
try{
|
||
var origin = Service.rsaData.value;
|
||
var pubkey = Service.rsapubkeySign.value;
|
||
var rsaSig = Service.rsaSigndata.value;
|
||
var result = SKFKEY.SKF_RSAVerify(dev, pubkey, origin, rsaSig);
|
||
if(result == 0)
|
||
PrintInfo("验签成功");
|
||
else
|
||
PrintInfo("验签失败,rev="+result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function RSAExportSessionKey() {
|
||
try{
|
||
var alg = Service.rsasessionKeyType.value;
|
||
var pubkey = Service.rsaSessionPub.value;
|
||
var result = SKFKEY.SKF_RSAExportSessionKey(con, alg, pubkey);
|
||
PrintInfo(JSON.stringify(result));
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ExtRSAPubKeyOperation() {
|
||
try{
|
||
var indata = Service.rsaDataOut.value;
|
||
var pubkey = Service.rsaKeyOut.value;
|
||
var result = SKFKEY.SKF_ExtRSAPubKeyOperation(dev, pubkey, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
function ExtRSAPriKeyOperation() {
|
||
try{
|
||
var indata = Service.rsaDataOut.value;
|
||
var prikey = Service.rsaKeyOut.value;
|
||
var result = SKFKEY.SKF_ExtRSAPriKeyOperation(dev, prikey, indata);
|
||
PrintInfo(result);
|
||
}catch (e) {
|
||
PrintInfo(e.message);
|
||
}
|
||
}
|
||
|
||
</script>
|
||
</head>
|
||
|
||
<body>
|
||
<div="root">
|
||
<header>
|
||
<div>
|
||
<h1 class="title">
|
||
SKF FisecKey demo
|
||
</h1>
|
||
<ul class="menu">
|
||
<li>
|
||
<a id = indexhtml onclick="reload()" href="../index.html?dev=0&app=0&con=0&conname=0">简介</a>
|
||
</li>
|
||
<li>
|
||
<a id = devhtml onclick="reload()" href="./devicemanager.html?dev=0&app=0&con=0&conname=0">设备管理</a>
|
||
</li>
|
||
<li>
|
||
<a id = apphtml onclick="reload()" href="./appmanager.html?dev=0&app=0&con=0&conname=0">应用管理</a>
|
||
</li>
|
||
<li>
|
||
<a id = authhtml onclick="reload()" href="./authmanager.html?dev=0&app=0&con=0&conname=0">访问控制</a>
|
||
</li>
|
||
<li>
|
||
<a id = filehtml onclick="reload()" href="./filemanager.html?dev=0&app=0&con=0&conname=0">文件管理</a>
|
||
</li>
|
||
<li>
|
||
<a id = containerhtml onclick="reload()" href="./containermanager.html?dev=0&app=0&con=0&conname=0">容器管理</a>
|
||
</li>
|
||
<li>
|
||
<a id = servicehtml onclick="reload()" href="./service.html?dev=0&app=0&con=0&conname=0" class='active'>密码服务</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</header>
|
||
<main>
|
||
<div class = "form-service">
|
||
<div class="nav-Service">
|
||
<div class="line">
|
||
<input class="nav-btn" type="button" value="SYM" onclick="navsym()" />
|
||
<input class="nav-btn" type="button" value="HASH" onclick="navhash()"/>
|
||
<input class="nav-btn" type="button" value="RSA" onclick="navrsa()" />
|
||
<input class="nav-btn" type="button" value="ECC" onclick="navecc()" />
|
||
<!-- <input class="nav-btn" type="button" value="MAC" onclick="navmac()" /> -->
|
||
<input class="nav-btn" type="button" value="关闭" onclick="navclose()" />
|
||
</div>
|
||
</div>
|
||
<form class="serviceForm" name = "Service">
|
||
<div class="form-group">
|
||
<div id="sym-content">
|
||
<div>
|
||
<div class="hrlineService"></div>
|
||
<label class="labelService">SYM</label>
|
||
<div class="hrlineService"></div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="randomLen">随机数长度</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input type="text" id="randomLen"/>
|
||
</div>
|
||
</div>
|
||
<div class="line-help">
|
||
<input class="btn" type="button" value="生成随机数" onclick="GenRandom()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="sessionKey">会话密钥</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input type="text" id="sessionKey"/>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="sessionKeyType">会话密钥类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="sessionKeyTypeSelect" id="sessionKeyType">
|
||
<option value="0">-- Select Alg --</option>
|
||
<option value="257">SM1-ECB</option>
|
||
<option value="258">SM1-CBC</option>
|
||
<option value="1025">SM4-ECB</option>
|
||
<option value="1026">SM4-CBC</option>
|
||
<option value="513">SSF33-ECB</option>
|
||
<option value="514">SSF33-CBC</option>
|
||
<option value="1">3DES-ECB</option>
|
||
<option value="2">3DES-CBC</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="明文导入会话密钥" onclick="SetSymmKey()" />
|
||
<input class="btn" type="button" value="导入会话密钥" onclick="SetSymmKey()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="symOrigin">对称原文/密文</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="symOrigin" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line-help">
|
||
<div class="help-tip">
|
||
<p>
|
||
对称原文/密文:此项在对称加密时输入原文,解密时输入密文
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="symOrigin">对称IV</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input type="text" id="symiv"/>
|
||
</div>
|
||
</div>
|
||
<div class="line-help">
|
||
<div class="help-tip">
|
||
<p>
|
||
对称IV:此项在对称加密模式为CBC时输入iv值,ecb时置空即可
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" class="labelhead" for="sympaddingType">补丁类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="sympaddingTypeSelect" id="sympaddingType">
|
||
<option value="0">NOPADDING</option>
|
||
<option value="1">PKCS5_PADDING</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="对称加密初始化" onclick="EncryptInit()" />
|
||
||
|
||
<input class="btn" type="button" value="单包对称加密" onclick="Encrypt()" />
|
||
||
|
||
<input class="btn" type="button" value="多包对称加密" onclick="EncryptUpdate()" />
|
||
<input class="btn" type="button" value="多包对称加密结束" onclick="EncryptFinal()" />
|
||
</div>
|
||
<div class="line"><div class="hrlineshort"></div></div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="对称解密初始化" onclick="DecryptInit()" />
|
||
||
|
||
<input class="btn" type="button" value="单包对称解密" onclick="Decrypt()" />
|
||
||
|
||
<input class="btn" type="button" value="多包对称解密" onclick="DecryptUpdate()" />
|
||
<input class="btn" type="button" value="多包对称解密结束" onclick="DecryptFinal()" />
|
||
</div>
|
||
</div>
|
||
|
||
<div id="hash-content" hidden>
|
||
<div>
|
||
<div class="hrlineService"></div>
|
||
<label class="labelService">HASH</label>
|
||
<div class="hrlineService"></div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="hashOrigin">原文数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="hashOrigin" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="hashpub">公钥数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="hashpub" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="hashid">ID数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="hashid" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="hashkey">算法类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="hashkeySelect" id="hashkey">
|
||
<option value="0">-- Select Alg --</option>
|
||
<option value="1">SM3</option>
|
||
<option value="2">SHA1</option>
|
||
<option value="4">SHA256</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="杂凑初始化" onclick="DigestInit()" />
|
||
||
|
||
<input class="btn" type="button" value="单组杂凑" onclick="Digest()" />
|
||
||
|
||
<input class="btn" type="button" value="多组数据杂凑" onclick="DigestUpdate()" />
|
||
<input class="btn" type="button" value="结束杂凑" onclick="DigestFinal()" />
|
||
</div>
|
||
</div>
|
||
|
||
<div id="rsa-content" hidden>
|
||
<div>
|
||
<div class="hrlineService"></div>
|
||
<label class="labelService">RSA</label>
|
||
<div class="hrlineService"></div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaContainer">目前使用容器</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input readonly type="textCon" id="rsaContainer"/>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<select class="select2" name="extbitlenname" id="extbitlen">
|
||
<option value="1024">1024</option>
|
||
<option value="2048">2048</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="生成外部RSA密钥对" onclick="GenExtRSAKey()" />
|
||
<input class="btn" type="button" value="生成RSA签名密钥对" onclick="GenRSAKeyPair()" />
|
||
</div>
|
||
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<select class="select2" name="rsapubkeyTypeName" id="rsapubkeyType">
|
||
<option value="1">签名</option>
|
||
<option value="0">加密</option>
|
||
</select>
|
||
</div>
|
||
<div class="lineright">
|
||
<input class="btn" type="button" value="导出RSA公钥" onclick="RSAExportPublicKey()" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="sessionKeyType">密钥类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="rsaimpSelect" id="rsaimpType">
|
||
<option value="0">-- Select Alg --</option>
|
||
<option value="257">SM1</option>
|
||
<option value="1025">SM4</option>
|
||
<option value="513">SSF33</option>
|
||
<option value="1">3DES</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsasymkey">对称密钥密文</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsasymkey" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaEncryptKey">RSA加密密钥对</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsaEncryptKey" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="导入RSA加密密钥" onclick="ImportRSAKeyPair()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaData">RSA原文</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsaData" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsapubkeySign">RSA公钥</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsapubkeySign" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaSigndata">RSA签名</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsaSigndata" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="RSA签名" onclick="RSASignData()" />
|
||
<input class="btn" type="button" value="RSA验签" onclick="RSAVerify()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaDataOut">外部运算数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsaDataOut" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaKeyOut">外部密钥数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsaKeyOut" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="RSA外部公钥运算" onclick="ExtRSAPubKeyOperation()" />
|
||
||
|
||
<input class="btn" type="button" value="RSA外部私钥运算" onclick="ExtRSAPriKeyOperation()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsasessionKeyType">会话密钥类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="rsasessionKeyTypeSelect" id="rsasessionKeyType">
|
||
<option value="0">-- Select Alg --</option>
|
||
<option value="257">SM1</option>
|
||
<option value="1025">SM4</option>
|
||
<option value="513">SSF33</option>
|
||
<option value="1">3DES</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="rsaSessionPub">公钥数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="rsaSessionPub" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead">会话密钥</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input class="btn" type="button" value="RSA生成导出会话密钥" onclick="RSAExportSessionKey()" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="ecc-content" hidden>
|
||
<div>
|
||
<div class="hrlineService"></div>
|
||
<label class="labelService">ECC</label>
|
||
<div class="hrlineService"></div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccContainer">目前使用容器</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input readonly type="textCon" id="eccContainer"/>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="生成ECC签名密钥对" onclick="GenECCKeyPair()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<select class="select2" name="eccpubkeyTypeName" id="eccpubkeyType">
|
||
<option value="1">签名</option>
|
||
<option value="0">加密</option>
|
||
</select>
|
||
</div>
|
||
<div class="lineright">
|
||
<input class="btn" type="button" value="导出ECC公钥" onclick="ECCExportPublicKey()" />
|
||
</div>
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccEncryptKey">ECC加密密钥对</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccEncryptKey" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="导入ECC加密密钥" onclick="ImportECCKeyPair()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccData">ECC原文</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccData" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccDataSign">ECC签名</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccDataSign" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccDataPubkey">ECC签名公钥</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccDataPubkey" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="ecc签名" onclick="ECCSignData()" />
|
||
<input class="btn" type="button" value="ecc验签" onclick="ECCVerify()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccDataOut">外部运算数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccDataOut" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccKeyOut">外部密钥数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccKeyOut" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccSignDataOut">外部签名数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccSignDataOut" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="ECC外部公钥加密" onclick="ExtECCEncrypt()" />
|
||
<input class="btn" type="button" value="ECC外部私钥解密" onclick="ExtECCDecrypt()" />
|
||
||
|
||
<input class="btn" type="button" value="ECC外部私钥签名" onclick="ExtECCSign()" />
|
||
<input class="btn" type="button" value="ECC外部公钥验签" onclick="ExtECCVerify()" />
|
||
</div>
|
||
<div class="line"><div class="hrline"></div></div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="sessionKeyType">会话密钥类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="EccsessionKeyTypeSelect" id="ECCsessionKeyType">
|
||
<option value="0">-- Select Alg --</option>
|
||
<option value="257">SM1</option>
|
||
<option value="1025">SM4</option>
|
||
<option value="513">SSF33</option>
|
||
<option value="1">3DES</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="eccSessionPub">公钥数据</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="eccSessionPub" cols="30" rows="5"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead">会话密钥</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input class="btn" type="button" value="ECC生成导出会话密钥" onclick="ECCExportSessionKey()" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="mac-content" hidden>
|
||
<div>
|
||
<div class="hrlineService"></div>
|
||
<label class="labelService">MAC</label>
|
||
<div class="hrlineService"></div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="mackey">目前密钥句柄</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input readonly type="textCon" id="mackey"/>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="macOrigin">MAC原文</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<textarea class="textarea1" id="macOrigin" cols="30" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="line-help">
|
||
<div class="help-tip">
|
||
<p>
|
||
MAC原文:此项在对称加密时输入原文,解密时输入密文
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="macOrigin">MAC IV</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input type="text" id="maciv"/>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" class="labelhead" for="macpaddingType">补丁类型</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<select name="macpaddingTypeSelect" id="macpaddingType">
|
||
<option value="0">NOPADDING</option>
|
||
<option value="1">PKCS5_PADDING</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="MAC初始化" onclick="MacInit()" />
|
||
||
|
||
<input class="btn" type="button" value="单组MAC运算" onclick="Mac()" />
|
||
||
|
||
<input class="btn" type="button" value="多组MAC运算" onclick="MacUpdate()" />
|
||
<input class="btn" type="button" value="多组MAC运算结束" onclick="MacFinal()" />
|
||
</div>
|
||
</div>
|
||
|
||
<div id="handle-content" hidden>
|
||
<div>
|
||
<div class="hrlineService"></div>
|
||
<label class="labelService">关闭句柄</label>
|
||
<div class="hrlineService"></div>
|
||
</div>
|
||
<div class="line">
|
||
<div class="lineleft">
|
||
<label class="labelhead" for="closehandle">句柄</label>
|
||
</div>
|
||
<div class="lineright">
|
||
<input type="text" id="closehandle"/>
|
||
</div>
|
||
</div>
|
||
<div class="line">
|
||
<input class="btn" type="button" value="关闭句柄" onclick="CloseHandle()" />
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
<div class="footer">
|
||
<input type="button" class="footclear" value="清空" onclick="clearconsole()" />
|
||
<textarea readonly class="footconsole" id="deviceManagerText" rows="8"></textarea>
|
||
</div>
|
||
</body>
|
||
</html>
|