前端页面读取ukey
生活随笔
收集整理的這篇文章主要介紹了
前端页面读取ukey
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1.引入signocx.cab
2.前端調(diào)用方法
<html> <head> <title>signseal</title> <script type="text/javascript"> function readseal() {alert("readseal");var obj = window.document.getElementById("ocx"); var seal;var sealInfo = obj.ReadSeal();var sealInfoList = sealInfo.toArray();if (sealInfoList[0]){seal = sealInfoList[0];alert(seal);document.getElementById("data").value = seal;var obj = window.document.getElementById("txt"); obj.value = sealInfoList[1];} }function sign() {alert("sign");var obj = window.document.getElementById("ocx"); var data = window.document.getElementById("data").value;var signInfo = obj.sign(data);var signInfoList = signInfo.toArray();var signature, signerCert,signature = signInfoList[0];signerCert = signInfoList[1];alert(signature);alert(signerCert); }function verify() {alert("verify");var obj = window.document.getElementById( "ocx"); var data = window.document.getElementById("data").value;var signature = window.document.getElementById("signature").value;var cert = window.document.getElementById("cert").value;var ok = obj.verify(data, signature, cert);alert(ok); }function getCertInfo() {var obj = window.document.getElementById( "txt");obj.value = "acb";alert("getCertInfo");var obj = window.document.getElementById( "ocx"); var cert = window.document.getElementById("cert").value;var certInfo = obj.GetCertInfo(cert);var certInfoList = certInfo.toArray();var sn,dn,fingersprint;sn = certInfoList[0];dn = certInfoList[1];fingersprint = certInfoList[2];alert(sn);alert(dn);alert(fingersprint); } </script> </head> <body> <table border="0"> <tr><td nowrap>原文</td> <td width="10"><input type="text" id="data" value="" ></td> </tr><tr><td nowrap>簽名值</td> <td width="10"><input type="text" id="signature" value="" ></td> </tr> <tr><td nowrap>證書</td> <td width="10"><input type="text" id="cert" value="" ></td> </tr> <tr><td width="10"><input type="button" value="讀取簽章" onclick="readseal()"></td></tr><tr><td width="10"><input type="button" value="數(shù)字簽名" onclick="sign()"></td></tr><tr><td width="10"><input type="button" value="驗證簽名" onclick="verify()"></td></tr><tr><td width="10"><input type="button" value="獲取證書信息" onclick="getCertInfo()"></tr> </table> <object id="ocx" classid="CLSID:4E194A99-7F41-453E-914C-544BB186A59C" codebase ="signocx.cab#version=1.0.0.3" width="100" height="50"> </object> <textarea id="txt"></textarea> </body> </html>總結(jié)
以上是生活随笔為你收集整理的前端页面读取ukey的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql amd.dll 后门_DLL
- 下一篇: 计算机硬盘型号怎么看,硬盘编号怎么看