Dear all . :)
i have 2 classes which generate a key look like this one :
Lg+jExclU6WUbd2bKF1OZay1A4vzMHff8Di2TLoBnTwvtmdzZQrq4JErJCJzurKlbNrIBs05q4wf5uTirLVREQ==
the 1st class :
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.spec.RSAPublicKeySpec;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
public final class c
{
public static String a(String paramString)
{
RSAPublicKeySpec localRSAPublicKeySpec = new RSAPublicKeySpec(new BigInteger("10112286041044524677370474027071982795012910242918225059850918516636207075459579978809350974292880747439598231248202571903886168440919550433176153445869513"), new BigInteger("65537"));
try
{
PublicKey localPublicKey = KeyFactory.getInstance("RSA").generatePublic(localRSAPublicKeySpec);
Cipher localCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
localCipher.init(1, localPublicKey);
String str2 = a.a(localCipher.doFinal(new String(paramString).getBytes("UTF-8")));
str1 = str2;
return str1;
}
catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
{
while (true)
{
localNoSuchAlgorithmException.printStackTrace();
str1 = "";
}
}
catch (NoSuchPaddingException localNoSuchPaddingException)
{
while (true)
{
localNoSuchPaddingException.printStackTrace();
str1 = "";
}
}
catch (Exception localException)
{
while (true)
{
localException.printStackTrace();
String str1 = "";
}
}
}
}
The second class which 1st class call it via :
String str2 = a.a(localCipher.doFinal(new String(paramString).getBytes("UTF-8")));
public final class a
{
private static char[] a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static String a(byte[] paramArrayOfByte)
{
int i = paramArrayOfByte.length;
StringBuffer localStringBuffer = new StringBuffer(3 * paramArrayOfByte.length / 2);
int j = i - 3;
int k = 0;
int m = 0;
while (true)
{
int i3;
if (m <= j)
{
int i2 = (0xFF & paramArrayOfByte[m]) << 16 | (0xFF & paramArrayOfByte[(m + 1)]) << 8 | 0xFF & paramArrayOfByte[(m + 2)];
localStringBuffer.append(a[(0x3F & i2 >> 18)]);
localStringBuffer.append(a[(0x3F & i2 >> 12)]);
localStringBuffer.append(a[(0x3F & i2 >> 6)]);
localStringBuffer.append(a[(i2 & 0x3F)]);
m += 3;
i3 = k + 1;
if (k >= 14)
{
localStringBuffer.append("\r\n");
k = 0;
continue;
}
}
else
{
if (m == i + 0 - 2)
{
int i1 = (0xFF & paramArrayOfByte[m]) << 16 | (0xFF & paramArrayOfByte[(m + 1)]) << 8;
localStringBuffer.append(a[(0x3F & i1 >> 18)]);
localStringBuffer.append(a[(0x3F & i1 >> 12)]);
localStringBuffer.append(a[(0x3F & i1 >> 6)]);
localStringBuffer.append("=");
}
while (true)
{
return localStringBuffer.toString();
if (m != i + 0 - 1)
continue;
int n = (0xFF & paramArrayOfByte[m]) << 16;
localStringBuffer.append(a[(0x3F & n >> 18)]);
localStringBuffer.append(a[(0x3F & n >> 12)]);
localStringBuffer.append("==");
}
}
k = i3;
}
}
}
i dont know wany way to do it ! so please kindly may you help with it !