redengineer / redmini

小红书小程序
17 stars 4 forks source link

小红书一键登录解析手机号失败,出现乱码 #756

Closed kuangtaozsl closed 1 month ago

kuangtaozsl commented 1 year ago

Issue类型

bug

问题模块

小程序Api

所属的服务商

微盟

平台

IDE

小红书版本信息

7.90

基础库版本

v3.54.0

用户ID

641421140000000012010512

发生问题的时间

2023-06-14 16:16:47 至 2023-06-14 16:16:47

问题描述

    SecretKeySpec keySpec = new SecretKeySpec(Base64.decodeBase64("akU1SU9LMmh3SGhUdzJJTQ=="), "AES");
    IvParameterSpec ivSpec = new IvParameterSpec(Base64.decodeBase64("aEU5clh6V1FLNDdJampUYw=="));

    Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
    cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
    byte[] decrypted = cipher.doFinal(Base64.decodeBase64("qLowgVgUhPPRecIf2mwrlVIgCh5//ynOYWWcwoPwZmMN/KPs8H5d4eeoCfQPfUW5ouieg4t/SMdjCtaW1GTV4tn+ETZvYGM1PGAP2uiAiDzRQC+k3LzeNXfph5NL3oKnbBP+c1813XVPGKND98I8tx2O/WDSNqUd8YO9/uHBxvuPziYJbb09BbrFfg6rNeWWployoVEj7HaS2z9HynPE3g=="));
    byte[] bytes = decode(decrypted);
    return new String(bytes, StandardCharsets.UTF_8);

期望结果

解析数手机号等相关json信息

重现步骤和复现问题的最小demo Github链接

一键登录得问题

github-actions[bot] commented 1 year ago

您好开发者, 我们已收到你的问题, 已通知开发团队进行处理! 如您未阅读我们的开发文档,可先参阅开发文档 小红书问题处置流程 :sparkles: 感谢您的提问!:sparkles:

kuangtaozsl commented 1 year ago

SecretKeySpec keySpec = new SecretKeySpec(Base64.decodeBase64("akU1SU9LMmh3SGhUdzJJTQ=="), "AES"); IvParameterSpec ivSpec = new IvParameterSpec(Base64.decodeBase64("aEU5clh6V1FLNDdJampUYw=="));

    Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
    cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
    byte[] decrypted = cipher.doFinal(Base64.decodeBase64("qLowgVgUhPPRecIf2mwrlVIgCh5//ynOYWWcwoPwZmMN/KPs8H5d4eeoCfQPfUW5ouieg4t/SMdjCtaW1GTV4tn+ETZvYGM1PGAP2uiAiDzRQC+k3LzeNXfph5NL3oKnbBP+c1813XVPGKND98I8tx2O/WDSNqUd8YO9/uHBxvuPziYJbb09BbrFfg6rNeWWployoVEj7HaS2z9HynPE3g=="));
    byte[] bytes = decode(decrypted);
    return new String(bytes, StandardCharsets.UTF_8);
kuangtaozsl commented 1 year ago

用这个