QgsPkiBundle::QgsPkiBundle( const QSslCertificate &clientCert, const QSslKey &clientKey, const QList<QSslCertificate> &caChain ) : mCert( QSslCertificate() ) , mCertKey( QSslKey() ) , mCaChain( caChain ) { setClientCert( clientCert ); setClientKey( clientKey ); }
void LoginReplyPacket::parseBody() { replyCode = decryptedBuf[0]; switch(replyCode) { case TQQ_LOGIN_REPLY_OK: { // length of 16 bytes: 001-016, session key setSessionKey(decryptedBuf+1); // 4 bytes: 017-020, user id(QQ number) qqNum = ntohl( *((int *)(decryptedBuf + TQQ_KEY_LENGTH + 1) ) ); // now we can set the file session key char *fsbuf = new char[TQQ_KEY_LENGTH + 4]; // copy the big endian qqNum directly memcpy(fsbuf, decryptedBuf + TQQ_KEY_LENGTH + 1 , 4); // qqNum in network bytes order // then, the session key memcpy(fsbuf+4, getSessionKey(), TQQ_KEY_LENGTH); // save it as the file session key setFileSessionKey((unsigned char *)EvaUtil::doMd5(fsbuf, 4 + TQQ_KEY_LENGTH)); delete []fsbuf; // 021-024 user IP IP = ntohl(* ((int *)(decryptedBuf + 21)) ); // 025-026 user port port = ntohs(* ((short *)(decryptedBuf + 25)) ); // 027-030 server IP ( always 127.0.0.1 in QQ2006 standard) serverIP = ntohl(* ((int *)(decryptedBuf + 27)) ); // 031-032 server port ( should be 0x1f40(8000) ) serverPort = ntohs(* ((short *)(decryptedBuf + 31)) ); // 033-036 login time loginTime = ntohl(* ((int *)(decryptedBuf + 33)) ); /// 037-038 2 unknown bytes // 039-062 file share token used in Qun disk share file access setFileShareToken(decryptedBuf+39); /// 063 -> 082: unknown bytes // 83-114 client key for QQ Home setClientKey(decryptedBuf+83, 32); // always 32 bytes long /// 115 - 118, unknown 4 bytes ( 0x00 00 00 01) /// 119 - 126, unknown 8 bytes, all 0x0s // 127-130 user IP when last login lastLoginIP = ntohl(* ((int *)(decryptedBuf + 127)) ); // 131-134 last login time, not sure lastLoginTime = ntohl(* ((int *)(decryptedBuf + 131)) ); // 135 - 138 might be IP, 4 bytes // 139 - 142 might be IP, 4 bytes // 143 -183 unknow bytes break; } case TQQ_LOGIN_REPLY_REDIRECT: // redirect user to another server for balance reason { // 001-004 user qq number qqNum = ntohl(* ((int *)(decryptedBuf + 1)) ); // 005-008 the new server IP address redirectedIP = ntohl(* ((int *)(decryptedBuf + 5)) ); // 009-010 the new server's Port number redirectedPort = ntohs(* ((short *)(decryptedBuf + 9)) ); break; } case TQQ_LOGIN_REPLY_PWD_ERROR: case TQQ_LOGIN_REPLY_NEED_REACTIVATE: // message from server when password is wrong. the messege is encoded by "GB18030" { char *tmpMsg = new char[bodyLength]; memcpy(tmpMsg, decryptedBuf+1, bodyLength-1); tmpMsg[bodyLength-1]=0; replyMessage.assign(tmpMsg); delete []tmpMsg; break; } case TQQ_LOGIN_REPLY_REDIRECT_EX: // redirect user to another server for balance reason { // 001-004 user qq number qqNum = ntohl(* ((int *)(decryptedBuf + 1)) ); /// 5 - 14, 10 unknown bytes // 005-008 the new server IP address redirectedIP = ntohl(* ((int *)(decryptedBuf + 15)) ); redirectedPort = -1; printf("login reply(first byte is reply code)\n"); for(int i=0; i<bodyLength; i++){ if(!(i%8)) printf("\n%d: ",i); char t = decryptedBuf[i]; printf("%2x ", (uint8_t)t); } printf("\n"); break; } case TQQ_LOGIN_REPLY_PWD_ERROR_EX: { char *tmpMsg = new char[bodyLength]; memcpy(tmpMsg, decryptedBuf+1, bodyLength-1); tmpMsg[bodyLength-1]=0; replyMessage.assign(tmpMsg); delete []tmpMsg; } break; default: replyCode = TQQ_LOGIN_REPLY_MISC_ERROR; { printf("login unknown reply(first byte is reply code)\n"); for(int i=0; i<bodyLength; i++){ if(!(i%8)) printf("\n%d: ",i); char t = decryptedBuf[i]; printf("%2x ", (uint8_t)t); } printf("\n"); } break; } }