回复 1# manbutianya
JS有无错误就不知道,只是调整了一下你的差别代码而以。[/b]
Dim $sResult
$sResult = _JsonRead("12345aa", "","1376264789")
MsgBox(0, "P值", $sResult)
Exit
Func _JsonRead($pwd = "", $mailp = "",$ts = "")
Local $sCode,$sResult
$sCode &= 'function json2str()' & @CRLF
$sCode &= '{' & @CRLF
$sCode &= "var pwd = '" & $pwd & "';" & @CRLF
$sCode &= "var p = '" & $mailp & "';" & @CRLF
$sCode &= "var ts = '" & $ts & "';" & @CRLF
$sCode &= 'var PublicKey = "CF87D7B4C864F4842F1D337491A48FFF54B73A17300E8E42FA365420393AC0346AE55D8AFAD975DFA175FAF0106CBA81AF1DDE4ACEC284DAC6ED9A0D8FEB1CC070733C58213EFFED46529C54CEA06D774E3CC7E073346AEBD6C66FC973F299EB74738E400B22B1E7CDC54E71AED059D228DFEB5B29C530FF341502AE56DDCFE9";' & @CRLF
$sCode &= 'var RSA = new RSAKey();' & @CRLF
$sCode &= 'RSA.setPublic(PublicKey, "10001");' & @CRLF
$sCode &= "var Res = RSA.encrypt(pwd+ '\n' + ts + '\n');" & @CRLF
$sCode &= 'if (Res)' & @CRLF
$sCode &= '{' & @CRLF
$sCode &= 'p = hex2b64(Res);' & @CRLF
$sCode &= 'pwd = "";' & @CRLF
$sCode &= '}' & @CRLF
$sCode &= 'return p' & @CRLF
$sCode &= '}' & @CRLF
MsgBox(0, "代码", $sCode)
Local $oScript = ObjCreate("MSScriptControl.ScriptControl.1")
$oScript.language = 'JavaScript'
$oScript.AddCode($sCode)
$sResult = $oScript.Run('json2str')
$oScript = 0
Return $sResult
EndFunc
|