diff --git a/client/global.go b/client/global.go index 5dbc5ef8..038992f0 100644 --- a/client/global.go +++ b/client/global.go @@ -151,12 +151,12 @@ func genVersionInfo(p ClientProtocol) *versionInfo { case AndroidPhone: // Dumped by mirai from qq android v8.2.7 return &versionInfo{ ApkId: "com.tencent.mobileqq", - AppId: 537062845, - SortVersionName: "8.2.7", - BuildTime: 1571193922, + AppId: 537066439, + SortVersionName: "8.4.18", + BuildTime: 1604580615, ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D}, - SdkVersion: "6.0.0.2413", - SSOVersion: 5, + SdkVersion: "6.0.0.2454", + SSOVersion: 13, MiscBitmap: 184024956, SubSigmap: 0x10400, MainSigMap: 34869472, diff --git a/protocol/crypto/crypto.go b/protocol/crypto/crypto.go index ea435785..06e8dc13 100644 --- a/protocol/crypto/crypto.go +++ b/protocol/crypto/crypto.go @@ -1,6 +1,7 @@ package crypto import ( + "crypto/elliptic" "crypto/md5" "crypto/rand" "github.com/Mrs4s/MiraiGo/binary" @@ -18,39 +19,42 @@ type EncryptSession struct { var ECDH = &EncryptECDH{} -var tenKeyX = new(big.Int).SetBytes([]byte{ // pubkey[1:24] - 0x92, 0x8d, 0x88, 0x50, 0x67, 0x30, 0x88, 0xb3, 0x43, 0x26, 0x4e, 0x0c, - 0x6b, 0xac, 0xb8, 0x49, 0x6d, 0x69, 0x77, 0x99, 0xf3, 0x72, 0x11, 0xde, +var tenKeyX = new(big.Int).SetBytes([]byte{ + 0xEB, 0xCA, 0x94, 0xD7, 0x33, 0xE3, 0x99, 0xB2, + 0xDB, 0x96, 0xEA, 0xCD, 0xD3, 0xF6, 0x9A, 0x8B, + 0xB0, 0xF7, 0x42, 0x24, 0xE2, 0xB4, 0x4E, 0x33, + 0x57, 0x81, 0x22, 0x11, 0xD2, 0xE6, 0x2E, 0xFB, }) -var tenKeyY = new(big.Int).SetBytes([]byte{ // pubkey[25:48] - 0xb2, 0x5b, 0xb7, 0x39, 0x06, 0xcb, 0x08, 0x9f, 0xea, 0x96, 0x39, 0xb4, - 0xe0, 0x26, 0x04, 0x98, 0xb5, 0x1a, 0x99, 0x2d, 0x50, 0x81, 0x3d, 0xa8, +var tenKeyY = new(big.Int).SetBytes([]byte{ + 0xC9, 0x1B, 0xB5, 0x53, 0x09, 0x8E, 0x25, 0xE3, + 0x3A, 0x79, 0x9A, 0xDC, 0x7F, 0x76, 0xFE, 0xB2, + 0x08, 0xDA, 0x7C, 0x65, 0x22, 0xCD, 0xB0, 0x71, + 0x9A, 0x30, 0x51, 0x80, 0xCC, 0x54, 0xA8, 0x2E, }) func init() { - key, sx, sy, err := secp192k1.GenerateKey(rand.Reader) + p256 := elliptic.P256() + key, sx, sy, err := elliptic.GenerateKey(p256, rand.Reader) if err != nil { panic("Can't Create ECDH key pair") } - x, _ := secp192k1.ScalarMult(tenKeyX, tenKeyY, key) - hash := md5.Sum(x.Bytes()) + x, _ := p256.ScalarMult(tenKeyX, tenKeyY, key) + hash := md5.Sum(x.Bytes()[:16]) ECDH.InitialShareKey = hash[:] - ECDH.PublicKey = make([]byte, 49)[:0] + ECDH.PublicKey = make([]byte, 65)[:0] ECDH.PublicKey = append(ECDH.PublicKey, 0x04) ECDH.PublicKey = append(ECDH.PublicKey, sx.Bytes()...) ECDH.PublicKey = append(ECDH.PublicKey, sy.Bytes()...) - - //ECDH.InitialShareKey, _ = hex.DecodeString("41d0d17c506a5256d0d08d7aac133c70") - //ECDH.PublicKey, _ = hex.DecodeString("049fb03421ba7ab5fc91c2d94a7657fff7ba8fe09f08a22951a24865212cbc45aff1b5125188fa8f0e30473bc55d54edc2") } func (e *EncryptECDH) DoEncrypt(d, k []byte) []byte { w := binary.NewWriter() - w.WriteByte(0x01) + w.WriteByte(0x02) w.WriteByte(0x01) w.Write(k) - w.WriteUInt16(258) + w.WriteUInt16(0x01_31) + w.WriteUInt16(0x00_01) w.WriteUInt16(uint16(len(ECDH.PublicKey))) w.Write(ECDH.PublicKey) w.EncryptAndWrite(ECDH.InitialShareKey, d) @@ -58,7 +62,7 @@ func (e *EncryptECDH) DoEncrypt(d, k []byte) []byte { } func (e *EncryptECDH) Id() byte { - return 7 + return 0x87 } func NewEncryptSession(t133 []byte) *EncryptSession {