|
30精币
public class a
{
public static String a(String p0){
byte[] uobyteArray;
try{
Cipher instance = Cipher.getInstance("RSA/ECB/PKCS1Padding");
instance.init(1, JWTHelper.getParsedPublicKey());
uobyteArray = a.b(p0.getBytes(), instance);
uobyteArray = Base64.encodeToString(uobyteArray, 2);
}catch(java.lang.Exception e3){
e3.printStackTrace();
uobyteArray = null;
}
return uobyteArray;
}
private static byte[] b(byte[] p0,Cipher p1){
int i2;
int len = p0.length;
ByteArrayOutputStream uByteArrayOu = new ByteArrayOutputStream();
int i = 0;
int i1 = i;
while ((i2 = len - i) > 0) {
byte[] uobyteArray = (i2 > 64)? p1.doFinal(p0, i, 64): p1.doFinal(p0, i, i2);
uByteArrayOu.write(uobyteArray, 0, uobyteArray.length);
i1 = i1 + 1;
i = i1 * 64;
}
uByteArrayOu.close();
return uByteArrayOu.toByteArray();
}
}
public static RSAPublicKey getParsedPublicKey(){
String secret = JWTHelper.getSecret();
String str = "";
if (!secret.isEmpty()) {
str = secret.replace(" ", str);
}
int i = 0;
try{
return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Base64.decode(str, i)));
}catch(java.security.NoSuchAlgorithmException e0){
}catch(java.security.spec.InvalidKeySpecException e0){
}
e0.printStackTrace();
return null;
}
public String getPublicKey(){
return this.context.getSharedPreferences("ACCOUNT", 0).getString("PUBLIC_KEY_"+this.getHostType(), "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLuCAxtV1Omu216OFdY0p2ypPRLpt噜阿噜gMqvpmgkXD/SaB5RPx5oTzo5fdWjeYAx8N6YAe0DDJD5LsmNGhvVIiKOz2wYI17DQRK6aymvBuxioQzeAd5vI8RItTS7QpNh/ABH/B/3XhhVwnXn40MdDQxA3E2yfEk327Kqy4TqtscwIDAQAB");
}
思路:String p0 获取其字节集 rsa分组加密 返回字节集 然后Base64.encodeToString这是一段安卓逆向代码 如何js写呢,者易语言改写呢?
补充内容 (2024-4-26 14:51):
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLuCAxtV1Omu216OFdY0p2ypPRLpt噜阿噜gMqvpmgkXD/SaB5RPx5oTzo5fdWjeYAx8N6YAe0DDJD5LsmNGhvVIiKOz2wYI17DQRK6aymvBuxioQzeAd5vI8RItTS7QpNh/ABH/B/3XhhVwnXn40MdDQxA3E2yfEk327Kqy4TqtscwIDAQAB |
|