错误 #1502:脚本的执行时间超过了默认 > 15 秒的超时时间
Error #1502: A script has executed for longer than the default > timeout period of 15 seconds
我正在尝试使用 Flash (AS3) 和 C# 作为服务器来制作一个安全的登录系统。但是我有这个问题:
Error: Error #1502: A script has executed for longer than the default
timeout period of 15 seconds.
at com.hurlant.crypto.rsa::RSAKey/_encrypt()[RSAKey.as:115]
at com.hurlant.crypto.rsa::RSAKey/encrypt()[RSAKey.as:89]
at client.login::createLogin$/rsaEncrypt()[login.as:30]
在 Flash 中我使用 AS3-CRYPTO 库:https://github.com/timkurvers/as3-crypto
闪现代码:
login.as
private static var w:String = "abcdefghijklmnopqrstuvwxyz";
private static var privKey = "zRSdzFcnZjOCxDMkWUbuRgiOZIQlk7frZMhElQ0a7VqZI9VgU3+lwo0ghZLU3Gg63kOY2UyJ5vFpQdwJUQydsF337ZAUJz4rwGRt/MNL70wm71nGfmdPv4ING+DyJ3ZxFawwE1zSMjMOqQtY4IV8his/HlgXuUfIHVDK87nMNLc=";
private static var privKey2 = "AQAB";
public function createLogin(nickname:String) : RequestLoader
{
var account:AccountInfo = Users.Account
account.Key = generateRsaKey(privKey,privKey2);
var byteArray:ByteArray = new ByteArray();
var tempPassword:String = "";
var tmpPassInt:int = 0;
while(tmpPassInt < 6)
{
tempPassword = tempPassword + w.charAt(int(Math.random() * 26));
tmpPassInt++;
}
byteArray.writeUTFBytes (account.Account + "," + account.Password + "," + tempPassword + "," + nickname);
var rsaEncrypted: String = rsaEncrypt(account.Key, byteArray);
var requestV:URLVariables = RequestVariableCreater.creatWidthKey(false);
requestV["v"] = rsaEncrypted;
var requestLoader:RequestLoader = Loader.creatLoader("Login.ashx",requestV);
}
public function generateRsaKey(param1:String, param2:String) : RSAKey
{
var key:BigInteger = new BigInteger(Base64.decodeToByteArray(param1));
var key2:BigInteger = new BigInteger(Base64.decodeToByteArray(param2));
return new RSAKey(key,key2.intValue());
}
public function rsaEncrypt(param1:RSAKey, param2:ByteArray) : String
{
var byteArray:ByteArray = new ByteArray();
param1.encrypt(param2,byteArray,param2.length);
return Base64.encodeByteArray(byteArray);
}
已解决。通过 PEM 创建 RSAKey 对象:
var pem:String = "-----BEGIN PUBLIC KEY-----\n" +
"MIqMAe3DQEBrGNADCBiQKBgQCOLfJKjA8DhOFse3ex4zdlu2oh\n" +
"E8g1AhDBpQKMQaPaCH/irVFijsmfOsWIWyRrcDmmj2CBaS4b\n" +
"EwsD/qANC5KpFRdCkrKM7cyi0peK3v1sZqMODdN04vc+N/JE\n" +
"xMLoaOo8xIDAQAB\n" +
"-----END PUBLIC KEY-----";
PEM.readRSAPublicKey(pem);
我正在尝试使用 Flash (AS3) 和 C# 作为服务器来制作一个安全的登录系统。但是我有这个问题:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds. at com.hurlant.crypto.rsa::RSAKey/_encrypt()[RSAKey.as:115] at com.hurlant.crypto.rsa::RSAKey/encrypt()[RSAKey.as:89] at client.login::createLogin$/rsaEncrypt()[login.as:30]
在 Flash 中我使用 AS3-CRYPTO 库:https://github.com/timkurvers/as3-crypto
闪现代码: login.as
private static var w:String = "abcdefghijklmnopqrstuvwxyz";
private static var privKey = "zRSdzFcnZjOCxDMkWUbuRgiOZIQlk7frZMhElQ0a7VqZI9VgU3+lwo0ghZLU3Gg63kOY2UyJ5vFpQdwJUQydsF337ZAUJz4rwGRt/MNL70wm71nGfmdPv4ING+DyJ3ZxFawwE1zSMjMOqQtY4IV8his/HlgXuUfIHVDK87nMNLc=";
private static var privKey2 = "AQAB";
public function createLogin(nickname:String) : RequestLoader
{
var account:AccountInfo = Users.Account
account.Key = generateRsaKey(privKey,privKey2);
var byteArray:ByteArray = new ByteArray();
var tempPassword:String = "";
var tmpPassInt:int = 0;
while(tmpPassInt < 6)
{
tempPassword = tempPassword + w.charAt(int(Math.random() * 26));
tmpPassInt++;
}
byteArray.writeUTFBytes (account.Account + "," + account.Password + "," + tempPassword + "," + nickname);
var rsaEncrypted: String = rsaEncrypt(account.Key, byteArray);
var requestV:URLVariables = RequestVariableCreater.creatWidthKey(false);
requestV["v"] = rsaEncrypted;
var requestLoader:RequestLoader = Loader.creatLoader("Login.ashx",requestV);
}
public function generateRsaKey(param1:String, param2:String) : RSAKey
{
var key:BigInteger = new BigInteger(Base64.decodeToByteArray(param1));
var key2:BigInteger = new BigInteger(Base64.decodeToByteArray(param2));
return new RSAKey(key,key2.intValue());
}
public function rsaEncrypt(param1:RSAKey, param2:ByteArray) : String
{
var byteArray:ByteArray = new ByteArray();
param1.encrypt(param2,byteArray,param2.length);
return Base64.encodeByteArray(byteArray);
}
已解决。通过 PEM 创建 RSAKey 对象:
var pem:String = "-----BEGIN PUBLIC KEY-----\n" +
"MIqMAe3DQEBrGNADCBiQKBgQCOLfJKjA8DhOFse3ex4zdlu2oh\n" +
"E8g1AhDBpQKMQaPaCH/irVFijsmfOsWIWyRrcDmmj2CBaS4b\n" +
"EwsD/qANC5KpFRdCkrKM7cyi0peK3v1sZqMODdN04vc+N/JE\n" +
"xMLoaOo8xIDAQAB\n" +
"-----END PUBLIC KEY-----";
PEM.readRSAPublicKey(pem);