mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-05 03:23:50 +08:00
fix ecdh Thanks @wfjsw
This commit is contained in:
parent
4fdf655598
commit
4046b67f9e
@ -151,7 +151,7 @@ func genVersionInfo(p ClientProtocol) *versionInfo {
|
|||||||
case AndroidPhone: // Dumped by mirai from qq android v8.2.7
|
case AndroidPhone: // Dumped by mirai from qq android v8.2.7
|
||||||
return &versionInfo{
|
return &versionInfo{
|
||||||
ApkId: "com.tencent.mobileqq",
|
ApkId: "com.tencent.mobileqq",
|
||||||
AppId: 537066419,
|
AppId: 537066439,
|
||||||
SortVersionName: "8.4.18",
|
SortVersionName: "8.4.18",
|
||||||
BuildTime: 1604580615,
|
BuildTime: 1604580615,
|
||||||
ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D},
|
ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D},
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"math/big"
|
"math/big"
|
||||||
)
|
)
|
||||||
@ -41,15 +40,15 @@ func init() {
|
|||||||
panic("Can't Create ECDH key pair")
|
panic("Can't Create ECDH key pair")
|
||||||
}
|
}
|
||||||
x, _ := p256.ScalarMult(tenKeyX, tenKeyY, key)
|
x, _ := p256.ScalarMult(tenKeyX, tenKeyY, key)
|
||||||
hash := md5.Sum(x.Bytes())
|
hash := md5.Sum(x.Bytes()[:16])
|
||||||
ECDH.InitialShareKey = hash[:]
|
ECDH.InitialShareKey = hash[:]
|
||||||
ECDH.PublicKey = make([]byte, 65)[:0]
|
ECDH.PublicKey = make([]byte, 65)[:0]
|
||||||
ECDH.PublicKey = append(ECDH.PublicKey, 0x04)
|
ECDH.PublicKey = append(ECDH.PublicKey, 0x04)
|
||||||
ECDH.PublicKey = append(ECDH.PublicKey, sx.Bytes()...)
|
ECDH.PublicKey = append(ECDH.PublicKey, sx.Bytes()...)
|
||||||
ECDH.PublicKey = append(ECDH.PublicKey, sy.Bytes()...)
|
ECDH.PublicKey = append(ECDH.PublicKey, sy.Bytes()...)
|
||||||
|
|
||||||
ECDH.InitialShareKey, _ = hex.DecodeString("c129edba736f4909ecc4ab8e010f46a3")
|
// ECDH.InitialShareKey, _ = hex.DecodeString("62625d204dc51a2f6dff86fc6277bb35")
|
||||||
ECDH.PublicKey, _ = hex.DecodeString("04edb8906046f5bfbe9abbc5a88b37d70a6006bfbabc1f0cd49dfb33505e63efc5d78ee4e0a4595033b93d02096dcd3190279211f7b4f6785079e19004aa0e03bc")
|
// ECDH.PublicKey, _ = hex.DecodeString("042b66bd2e00591b4b97c915daf8c0b89f862241563e6f0455976e483706a2ca7a823c10636ecb03826ecd76ba46f5702f66ea671a2e09204591104077ebdf3f03")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EncryptECDH) DoEncrypt(d, k []byte) []byte {
|
func (e *EncryptECDH) DoEncrypt(d, k []byte) []byte {
|
||||||
@ -58,7 +57,7 @@ func (e *EncryptECDH) DoEncrypt(d, k []byte) []byte {
|
|||||||
w.WriteByte(0x01)
|
w.WriteByte(0x01)
|
||||||
w.Write(k)
|
w.Write(k)
|
||||||
w.WriteUInt16(0x01_31)
|
w.WriteUInt16(0x01_31)
|
||||||
w.WriteUInt16(0x00_02)
|
w.WriteUInt16(0x00_01)
|
||||||
w.WriteUInt16(uint16(len(ECDH.PublicKey)))
|
w.WriteUInt16(uint16(len(ECDH.PublicKey)))
|
||||||
w.Write(ECDH.PublicKey)
|
w.Write(ECDH.PublicKey)
|
||||||
w.EncryptAndWrite(ECDH.InitialShareKey, d)
|
w.EncryptAndWrite(ECDH.InitialShareKey, d)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user