qq2320087128 发表于 2020-9-10 16:53:03

请教一个问题,反编译后Java的这个循环分段加密

搞了几天了,还是有点不明白,这个是代码

public static String encryptRsa(String arg5, String arg6) throws Exception {
      int v1;
      ByteArrayOutputStream v2;
      Cipher v0 = Cipher.getInstance("RSA/ECB/PKCS1Padding");
      v0.init(1, WeiboIdTask.getPublicKey(arg6));
      arg6 = "UTF-8";
      byte[] v5 = arg5.getBytes(arg6);
      try {
            v2 = new ByteArrayOutputStream();
            v1 = 0;
      }
      catch(Throwable v5_1) {
            v2 = ((ByteArrayOutputStream)v1);
            goto label_36;
      }

      while(true) {
            int v3 = 117;
            try {
                v3 = WeiboIdTask.splite(v5, v1, v3);
                if(v3 != -1) {
                  v2.write(v0.doFinal(v5, v1, v3));
                  v1 += v3;
                  continue;
                }

                v2.flush();
                String v0_1 = new String(Base64.encodebyte(v2.toByteArray()), arg6);
            }


    private static int splite(byte[] arg1, int arg2, int arg3) {
      if(arg2 >= arg1.length) {
            return -1;
      }

      return Math.min(arg1.length - arg2, arg3);
    }


//这是完整的加密明文一共长度为360,上面那个循环就是处理这个明文
{"1":"Android 5.1.1","2":"865166028402405","3":"865166028402405","4":"460003648720333","5":"00:81:36:cc:7c:a9","6":"89860001116798046951","7":"0038a704","10":"9e5a19a004e6b36b","13":"armeabi-v7a","14":"Mi 10 Pro","15":"16776077312","16":"540*960","17":"\"korman\"","18":"Xiaomi","19":"wifi","20":"Xiaomi-Mi 10 Pro__weibosdk__0041005000__android__android5.1.1"}

//以下是我FD抓包的
TTN4Yh8a7dR6pTspmAPlsXj11jhnjSV/xIr3SP/H2HBjcyfCjgVq0+znZHnlZWsBH2IzF31cGmHKhW0AxmNmQ2V15P4HUj7SAQrnr1i++pPTSRC43/N15x1G1odWvBXXmGG9KF/FGOyem8W1jb/VC1410lC+5hWX9OkYSfQh20s1RCfDwqKqVX/XSivEgFkhJOfexDyXehyaVZPjzCwKuNwhwrQ5HGVXhIUeX/nvCD9cHoz9vJxKlAV9prAkQsnXUJnyJmhqRYkMqvL2R17TBP/KnrrXg3aleksu6G3RmyrWO0uWhjyYp/WnVIlLR3rvsjhu37DNuwYP+jB5zM7PsDQWsV/6klnMnw+3p5Hiy+QnM1K/LiQAMYCsRvgFSJTPomt9pN3KV9zuQ2OtKV2fb4uJi4UBqDhlk1+JTWwFLHl3QJ25F9I10jA5sHlJ41fyR4CuP7X7czcALWt55T9FNhwXxLZiaCuL0f58Y4TmKSD7XpG/JqyNSdQBiiZdti8TE/1H0VBU84P5kgamudAg6DS+mUHXbEFd+q744BP3LhiL1Ie5YoP0nexO4VqCCmI9lhnw+JYlQdUOTdx0mkOTjDyZkMjX/+cymn93tXlE0qN/lsS552fixnkXHQ5Fxjt+9bAtMJL+hrYTfwT8WocPPXC+/OPeLZIiJnBxlGkfcmU=

//以下是我Hook到的加密
{"1":"Android 5.1.1","2":"865166028402405","3":"865166028402405","4":"460003648720333","5":"00:81:36:cc:7c:a9","6":"8    第一段加密明文
TTN4Yh8a7dR6pTspmAPlsXj11jhnjSV/xIr3SP/H2HBjcyfCjgVq0+znZHnlZWsBH2IzF31cGmHKhW0AxmNmQ2V15P4HUj7SAQrnr1i++pPTSRC43/N15x1G1odWvBXXmGG9KF/FGOyem8W1jb/VC1410lC+5hWX9OkYSfQh20s=    Hook到的加密值

9860001116798046951","7":"0038a704","10":"9e5a19a004e6b36b","13":"armeabi-v7a","14":"Mi 10 Pro","15":"16776077312","1    第二段加密明文
WU6CjEbV33rgPLgUL+7fofaLNIWSxZW2N0w4PWMlG5V83Kp01EnSixUm6AXdcMD1KF5IVRGGHNpjE98xG4Z1XYSF0Xo0t407hmtYM5zVU9zDzbNCgcCqls4NnS6NVaHD2EW7ptgSCc3CP3oAuFB1sHmmeBiiXLvuCLjjVfLR87k=   Hook到的加密值

6":"540*960","17":"\"korman\"","18":"Xiaomi","19":"wifi","20":"Xiaomi-Mi 10 Pro__weibosdk__0041005000__android__andro    第三段加密明文
aovcx9s0Yxvk5j0FJWITKPEc5XSmayRFwRRIRs6nn93OlF0/2CEsImalcjT9EFeDGPDQggRZNdRJ9fUiUB1jJljb3ItwoLLejS6AbcPsVUoFYsGqH+s2a4hLPHdnAn1iyKYhqa03ielqGzqhv4BTmMzljMIXRy48PenoQ3dUPnw=    Hook到的加密值

id5.1.1"}    第四段加密明文
E/1H0VBU84P5kgamudAg6DS+mUHXbEFd+q744BP3LhiL1Ie5YoP0nexO4VqCCmI9lhnw+JYlQdUOTdx0mkOTjDyZkMjX/+cymn93tXlE0qN/lsS552fixnkXHQ5Fxjt+9bAtMJL+hrYTfwT8WocPPXC+/OPeLZIiJnBxlGkfcmU=    Hook到的加密值

其中第一个循环Hook到的加密值最后2位不对其他的对上了,第四个循环Hook到的加密值和抓包返回的全部对上了,第二个循环加密的和第三个循环加密的数据对不上

总长度360
第一次循环是取前0-117
第二次循环是取117-234
第三次循环是取234-351
第四次循环是取351-360
然后分段加密拼接,FD抓包返回回来的密文长度是684,我自己分段加密拼接是688,求大神指点。


这个是公钥:MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHHM0Fi2Z6+QYKXqFUX2Cy6AaWq3cPi+GSn9oeAwQbPZR75JB7Netm0HtBVVbtPhzT7UO2p1JhFUKWqrqoYuAjkgMVPmA0sFrQohns5EE44Y86XQopD4ZO+dE5KjUZFE6vrPO3rWW3np2BqlgKpjnYZri6TJApmIpGcQg9/G/3zQIDAQAB

用的是RSA/ECB/PKCS1Padding加密


页: [1]
查看完整版本: 请教一个问题,反编译后Java的这个循环分段加密