Exemplo n.º 1
0
        public int VerifyURL(string mToken, string mEncodingAesKey, string msgSignature, string timeStamp, string nonce, string encryptStr, ref string suiteKey)
        {
            var ret = 0;
            List <SuiteKeyInfo> suikKeyList = new Select().From(SuiteKeyInfo.Schema).ExecuteTypedList <SuiteKeyInfo>();

            foreach (SuiteKeyInfo suiteKeyInfo in suikKeyList)
            {
                DingTalkCrypt dingTalk = new DingTalkCrypt(mToken, mEncodingAesKey, suiteKeyInfo.SuiteKey);
                string        sEchoStr = "";
                ret = dingTalk.VerifyURL(msgSignature, timeStamp, nonce, encryptStr, ref sEchoStr);
                if (ret == 0)
                {
                    IsvReceive isvReceive = new IsvReceive
                    {
                        Signature  = msgSignature,
                        Timestamp  = timeStamp,
                        Nonce      = nonce,
                        Encrypt    = encryptStr,
                        EchoString = sEchoStr,
                        CreateTime = DateTime.Now
                    };
                    isvReceive.Save();
                    suiteKey = suiteKeyInfo.SuiteKey;
                    return(ret);
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
 public int VerifyURL(string mToken,string mEncodingAesKey, string msgSignature, string timeStamp,string nonce,string encryptStr,ref string suiteKey)
 {
     var ret = 0;
     List<SuiteKeyInfo> suikKeyList = new Select().From(SuiteKeyInfo.Schema).ExecuteTypedList<SuiteKeyInfo>();
     foreach (SuiteKeyInfo suiteKeyInfo in suikKeyList)
     {
         DingTalkCrypt dingTalk = new DingTalkCrypt(mToken, mEncodingAesKey, suiteKeyInfo.SuiteKey);
         string sEchoStr = "";
         ret = dingTalk.VerifyURL(msgSignature, timeStamp, nonce, encryptStr, ref sEchoStr);
         if (ret == 0)
         {
             IsvReceive isvReceive = new IsvReceive
             {
                 Signature = msgSignature,
                 Timestamp = timeStamp,
                 Nonce = nonce,
                 Encrypt = encryptStr,
                 EchoString = sEchoStr,
                 CreateTime = DateTime.Now
             };
             isvReceive.Save();
             suiteKey = suiteKeyInfo.SuiteKey;
             return ret;
         }
     }
     return ret;
 }