错误#1502:脚本的执行时间超过默认值> 15秒的超时时间

时间:2019-07-18 18:13:17

标签: actionscript-3 encryption rsa as3crypto

我正在尝试使用Flash(AS3)和C#作为服务器来构建安全的登录系统。但是我有这个问题:

  

错误:错误#1502:脚本的执行时间超过默认时间   超时时间为15秒。         在com.hurlant.crypto.rsa :: RSAKey / _encrypt()[RSAKey.as:115]         在com.hurlant.crypto.rsa :: RSAKey / encrypt()[RSAKey.as:89]         在client.login :: createLogin $ / rsaEncrypt()[login.as:30]

在Flash中,我使用AS3-CRYPTO库:https://github.com/timkurvers/as3-crypto

Flash代码: 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);
        }

1 个答案:

答案 0 :(得分:1)

已解决。通过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);