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); }
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)); } }