收藏
回答

支付分确认回调,密文解密后的字符串不是JSON格式?

解密结果为:

{

    "appid": "wx4edxxd888b9",

    "mchid": "170xx523",

    "service_id": "00002xxxxx58980945787",

    "out_order_no": "2025xxxx15834",

    "service_introduction": "充电宝免押",

    "state": "DOING",

    "state_description": "USER_CONFIRM",

    "total_amount": 0,

    "risk_fund": {

        "name": "DEPOSIT",

        "amount": 99,

        "description": "租借充电宝免押金"

    },

    "time_range": {

        "start_time": "20250729110625"

    },

    "attach": "充电宝免押",

    "notify_url": "https://chengxxxhineng.com/oreBack/WetScorexxBack",

    "order_id": "1000000000202507291103118571229",

    "need_collection": true,

    "openid": "or3NX7ELQ53-24hA

最后一次编辑于  07-29
回答关注问题邀请回答
收藏

3 个回答

  • Memory (私信不回复)
    Memory (私信不回复)
    07-29

    在这里验证一下https://tools.aifuwu.net/wechat-pay-tools/apiv3-key-validator

    07-29
    有用
    回复
  • 陈大六
    陈大六
    07-29

    C# 版本的解密方法:

     private static string ALGORITHM = "AES/GCM/NoPadding";

     private static int TAG_LENGTH_BIT = 128;

     private static int NONCE_LENGTH_BYTE = 12;

     private static string AES_KEY = API_KEY; //youkeyhere

     public static string AesGcmDecrypt(string associatedData, string nonce, string ciphertext)

     {

         GcmBlockCipher gcmBlockCipher = new GcmBlockCipher(new AesEngine());

         AeadParameters aeadParameters = new AeadParameters(

             new KeyParameter(Encoding.UTF8.GetBytes(AES_KEY)),

             128,

             Encoding.UTF8.GetBytes(nonce),

             Encoding.UTF8.GetBytes(associatedData));

         gcmBlockCipher.Init(false, aeadParameters);

         byte[] data = Convert.FromBase64String(ciphertext);

         byte[] plaintext = new byte[gcmBlockCipher.GetOutputSize(data.Length)];

         int length = gcmBlockCipher.ProcessBytes(data, 0, data.Length, plaintext, 0);

         return Encoding.UTF8.GetString(plaintext);

     }

    07-29
    有用
    回复
  • Mr.Zhao
    Mr.Zhao
    发表于移动端
    07-29
    不是json,是啥
    07-29
    有用
    回复 2
    • 陈大六
      陈大六
      07-29
      后面缺少 }  以及  openid 不完整
      07-29
      回复
    • Mr.Zhao
      Mr.Zhao
      发表于移动端
      07-29回复陈大六
      io流没读完呗
      07-29
      回复
登录 后发表内容