function getKey(){var n,t;try{n=document.getElementById("plugin0"),t=n.FindPort(0)}catch(i){try{n=new ActiveXObject("Syunew6A.s_simnew6"),t=n.FindPort(0)}catch(r){n=undefined}}finally{return n}}function getKeyOfParentFrame(){var n,t,i;try{i=window.parent.parent.parent.frames.TopFrame.document,n=i.getElementById("plugin0"),t=n.FindPort(0)}catch(r){try{n=new ActiveXObject("Syunew6A.s_simnew6"),t=n.FindPort(0)}catch(u){n=undefined}}finally{return n}}function getKeyIDOfParentFrame(){var t,r,u,f,n=getKeyOfParentFrame(),i="";return n==undefined||(t=n.FindPort(0),n.LastError!=0||(i=toHex(n.GetID_1(t))+toHex(n.GetID_2(t)),n.LastError!=0&&alert("获取keyID错误,错误码"+n.LastError.toString()))),i}function getUserName(){var f=GetCurSonTab(),t=f.find("#keydiv"),i,e,o,r,n=getKey(),u;if(n==undefined)t.text("");else{if(i=n.FindPort(0),n.LastError!=0){t.text("【未发现秘钥】");return}if(e=n.YRead(0,1,"ffffffff","ffffffff",i),r=n.GetBuf(0),u=n.YReadString(1,r,"ffffffff","ffffffff",i),n.LastError!=0){t.text("【读取错误1,ErrCode:"+n.LastError.toString()+"】");return}t.text("【"+u+"】")}}function getPubKeyX(){var i,n,t=getKey();return t!=undefined?(i=t.FindPort(0),t.LastError!=0?n="":(n=t.GetPubKeyX(i),t.LastError!=0&&(n=""))):n="",n}function getPubKeyY(){var i,n,t=getKey();return t!=undefined?(i=t.FindPort(0),t.LastError!=0?n="":(n=t.GetPubKeyY(i),t.LastError!=0&&(n=""))):n="",n}function getKeyID(){var t,r,u,f,n=getKey(),i="";return n==undefined||(t=n.FindPort(0),n.LastError!=0||(i=toHex(n.GetID_1(t))+toHex(n.GetID_2(t)),n.LastError!=0&&alert("获取keyID错误,错误码"+n.LastError.toString()))),i}function toHex(n){for(var f=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],i="",u=!0,r,t=32;t>0;)t-=4,r=n>>t&15,u&&r==0||(u=!1,i+=f[r]);return i==""?"0":i}function getSm2EncData(n){var t,r,i,u;return i="",t=getKey(),t!=undefined&&(r=t.FindPort(0),u="8g6dw2ilpq",i=t.YtSign(n,u,r)),i}function addEvent(n,t,i){n.attachEvent?n.attachEvent("on"+t,i):n.addEventListener&&(n.addEventListener(t,i,!1),n.addEventListener(t,i,!0))}