Skip to main content

XTC V3 API Encryption/Decryption utilities (reverse-engineered from com.xtc.moment)

Project description

xtcv3utils

XTC V3 API 加密/解密工具 — 逆向自 Android com.xtc.moment (小天才电话手表) 的 V3 加密方案。

Reverse-engineered V3 API encryption/decryption utilities for XTC Moment smartwatch app.

安装 / Install

pip install xtcv3utils

需要依赖 pycryptodome

快速开始 / Quick Start

from xtcv3utils import V3Client

client = V3Client(
    aes_key="your-aes-key",
    eebbk_key="rsa-encrypted-eebbk-key",
    key_id="your-key-id",
    watch_id="your-watch-id",
    device_id="bind-number",
    token="chip-id",
    mac="mac-address",
)

# 加密请求
headers, encrypted_body = client.encrypt_request(
    url="https://api.example.com/moment/public",
    body='{"watchId":"your-watch-id","content":"hello","type":3}',
)

# 解密响应
plain_text = client.decrypt_response(
    response_body=response_text,
    is_encrypted=True,
)

API

V3Client

方法 说明
encrypt_request(url, body, extra_headers) 加密完整请求,返回 (headers, encrypted_body)
decrypt_response(response_body, is_encrypted) 解密服务器响应
build_base_param_json() 构建基础参数 JSON(deviceId, token, timestamp 等)
generate_sign(url, base_param_json, body) 计算 Eebbk-Sign

create_client_from_decrypted_keys(key_str, ...)

"keyId:aesKey:eebbkKey" 格式的密钥字符串直接创建客户端。

V3 加密原理

步骤 算法 用途
密钥传输 RSA/ECB/PKCS1Padding 安全分发 AES 密钥
参数加密 AES/ECB/PKCS5Padding 加密设备信息 (Base-Request-Param)
Body 加密 GZip → AES/ECB/PKCS5Padding → Base64 压缩并加密请求体
签名 MD5(url + baseParam + body + aesKey) 请求完整性校验
响应解密 AES 解密 → GZip 解压 读取加密响应

签名使用的 URL 不包含 ?uuid=xxx 参数(uuid 在签名完成后才追加)。

相关项目

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xtcv3utils-1.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xtcv3utils-1.0.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file xtcv3utils-1.0.0.tar.gz.

File metadata

  • Download URL: xtcv3utils-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xtcv3utils-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c213535f2f3e8a1b59e51215da9858a85b0d0aeb7af5127bef091533c40a727d
MD5 498081ab63a47469d6c9393bbf973cf8
BLAKE2b-256 bb89effcb59d9ec543374d57704a0cba894c7405f0c908ce51570dac023d30b2

See more details on using hashes here.

File details

Details for the file xtcv3utils-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: xtcv3utils-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xtcv3utils-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34bbb2042a44f043e63e31b663022e91a5813e1f830e11f70814896b8010f014
MD5 0b070fe09a6ba90b9e847ef37e16b7d8
BLAKE2b-256 7ac06f2b440e792e4ef0a1614ef918edf260d00d952913a6fb9b5f039d74ab26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page