@Test public void testDecrypt() { UserToken token = Utils.decrypt(TOKEN); assertNotNull(token); assertEquals("12345678990", token.getUuid()); assertEquals("edifice.reception", token.getService()); assertEquals("aaaa", token.getLogin()); assertEquals("aaaa", token.getPassword()); }
public static UserToken decrypt(String message) { StringTokenizer st = new StringTokenizer(message, "-"); ArrayList<BigInteger> idPartToDecrypt = new ArrayList<BigInteger>(); while (st.hasMoreTokens()) { String idpart = st.nextToken(); idPartToDecrypt.add(new BigInteger(idpart)); } List<BigInteger> idPartDecrypted = decryptRSA(idPartToDecrypt); StringBuilder sb = new StringBuilder(); for (BigInteger bigInteger : idPartDecrypted) { String aChar = Character.valueOf((char) bigInteger.intValue()) .toString(); sb.append(aChar); } final String clear = sb.toString(); final int index1 = clear.indexOf('|'); final int index2 = clear.indexOf('|', index1 + 1); final int index3 = clear.indexOf('|', index2 + 1); final String deviceuuid = clear.substring(0, index1); final String service = clear.substring(index1 + 1, index2); final String user = clear.substring(index2 + 1, index3); final String password = clear.substring(index3 + 1); return new UserToken(deviceuuid, service, user, password); }
Utils { public static UserToken decrypt(String message) { StringTokenizer st = new StringTokenizer(message, "-"); ArrayList<BigInteger> idPartToDecrypt = new ArrayList<BigInteger>(); while (st.hasMoreTokens()) { String idpart = st.nextToken(); idPartToDecrypt.add(new BigInteger(idpart)); } List<BigInteger> idPartDecrypted = decryptRSA(idPartToDecrypt); StringBuilder sb = new StringBuilder(); for (BigInteger bigInteger : idPartDecrypted) { String aChar = Character.valueOf((char) bigInteger.intValue()) .toString(); sb.append(aChar); } final String clear = sb.toString(); final int index1 = clear.indexOf('|'); final int index2 = clear.indexOf('|', index1 + 1); final int index3 = clear.indexOf('|', index2 + 1); final String deviceuuid = clear.substring(0, index1); final String service = clear.substring(index1 + 1, index2); final String user = clear.substring(index2 + 1, index3); final String password = clear.substring(index3 + 1); return new UserToken(deviceuuid, service, user, password); } }
Utils { public static UserToken decrypt(String message) { StringTokenizer st = new StringTokenizer(message, "-"); ArrayList<BigInteger> idPartToDecrypt = new ArrayList<BigInteger>(); while (st.hasMoreTokens()) { String idpart = st.nextToken(); idPartToDecrypt.add(new BigInteger(idpart)); } List<BigInteger> idPartDecrypted = decryptRSA(idPartToDecrypt); StringBuilder sb = new StringBuilder(); for (BigInteger bigInteger : idPartDecrypted) { String aChar = Character.valueOf((char) bigInteger.intValue()) .toString(); sb.append(aChar); } final String clear = sb.toString(); final int index1 = clear.indexOf('|'); final int index2 = clear.indexOf('|', index1 + 1); final int index3 = clear.indexOf('|', index2 + 1); final String deviceuuid = clear.substring(0, index1); final String service = clear.substring(index1 + 1, index2); final String user = clear.substring(index2 + 1, index3); final String password = clear.substring(index3 + 1); return new UserToken(deviceuuid, service, user, password); } private  Utils(); }
Utils { public static UserToken decrypt(String message) { StringTokenizer st = new StringTokenizer(message, "-"); ArrayList<BigInteger> idPartToDecrypt = new ArrayList<BigInteger>(); while (st.hasMoreTokens()) { String idpart = st.nextToken(); idPartToDecrypt.add(new BigInteger(idpart)); } List<BigInteger> idPartDecrypted = decryptRSA(idPartToDecrypt); StringBuilder sb = new StringBuilder(); for (BigInteger bigInteger : idPartDecrypted) { String aChar = Character.valueOf((char) bigInteger.intValue()) .toString(); sb.append(aChar); } final String clear = sb.toString(); final int index1 = clear.indexOf('|'); final int index2 = clear.indexOf('|', index1 + 1); final int index3 = clear.indexOf('|', index2 + 1); final String deviceuuid = clear.substring(0, index1); final String service = clear.substring(index1 + 1, index2); final String user = clear.substring(index2 + 1, index3); final String password = clear.substring(index3 + 1); return new UserToken(deviceuuid, service, user, password); } private  Utils(); static String soapCall(URL url, String soapData, String soapAction,
            String xPathResult); static UserToken decrypt(String message); static String jsonOutput(Object data); static String formatMontant(String montant); static String formatDescription(String desc); static String readFile(File inputFile); }
Utils { public static UserToken decrypt(String message) { StringTokenizer st = new StringTokenizer(message, "-"); ArrayList<BigInteger> idPartToDecrypt = new ArrayList<BigInteger>(); while (st.hasMoreTokens()) { String idpart = st.nextToken(); idPartToDecrypt.add(new BigInteger(idpart)); } List<BigInteger> idPartDecrypted = decryptRSA(idPartToDecrypt); StringBuilder sb = new StringBuilder(); for (BigInteger bigInteger : idPartDecrypted) { String aChar = Character.valueOf((char) bigInteger.intValue()) .toString(); sb.append(aChar); } final String clear = sb.toString(); final int index1 = clear.indexOf('|'); final int index2 = clear.indexOf('|', index1 + 1); final int index3 = clear.indexOf('|', index2 + 1); final String deviceuuid = clear.substring(0, index1); final String service = clear.substring(index1 + 1, index2); final String user = clear.substring(index2 + 1, index3); final String password = clear.substring(index3 + 1); return new UserToken(deviceuuid, service, user, password); } private  Utils(); static String soapCall(URL url, String soapData, String soapAction,
            String xPathResult); static UserToken decrypt(String message); static String jsonOutput(Object data); static String formatMontant(String montant); static String formatDescription(String desc); static String readFile(File inputFile);  }