Example #1
0
        protected virtual HandshakeParam createHandShakeParam(string randomKey)
        {
            HandshakeParam param = new HandshakeParam();
            string         randomKeyEncrypted = RSAUtil.EncryptByPublicKey(randomKey, publicKey);

            param.app_key = this.AppKey;
            param.data    = randomKeyEncrypted;
            return(param);
        }
Example #2
0
 protected virtual void handshake()
 {
     try
     {
         string randomKey = this.createRandomKey();
         // 传递随机数
         HandshakeParam param = this.createHandShakeParam(randomKey);
         string         json  = this.OpenRequest.PostJsonBody(this.handshakeUrl, JsonUtil.ToJSONString(param));
         checkHandshakeResponse(json, randomKey);
         this.randomKey = randomKey;
     }
     catch (Exception e)
     {
         throw new SystemException(string.Format("握手失败:{0}", e.Message));
     }
 }