Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.6 kB
3
Indexable
Never
protected String[] doInBackground(URL... urls) {
        String theStrings[]=new String[4];
        try {
            HttpsURLConnection httpsURLConnectionPUB = (HttpsURLConnection) urls[0].openConnection();
            InputStream inputStreamPUB = httpsURLConnectionPUB.getInputStream();
            BufferedReader bufferedReaderPUB = new BufferedReader(new InputStreamReader(inputStreamPUB));
            String linePUB = "";
            while (linePUB != null) {

                linePUB = bufferedReaderPUB.readLine();
                if (linePUB != null)
                    publicKey = publicKey + linePUB;
            }


            HttpsURLConnection httpsURLConnectionKEY = (HttpsURLConnection) urls[1].openConnection();
            InputStream inputStreamKEY = httpsURLConnectionKEY.getInputStream();
            BufferedReader bufferedReaderKEY = new BufferedReader(new InputStreamReader(inputStreamKEY));
            String lineKey = "";
            while (lineKey != null) {

                lineKey = bufferedReaderKEY.readLine();
                if (lineKey != null)
                    AESKey = AESKey + lineKey;
            }

            theStrings[1]=AESKey;

            HttpsURLConnection httpsURLConnectionIV = (HttpsURLConnection) urls[2].openConnection();
            InputStream inputStreamIV = httpsURLConnectionIV.getInputStream();
            BufferedReader bufferedReaderIV = new BufferedReader(new InputStreamReader(inputStreamIV));
            String lineIV = "";
            while (lineIV != null) {

                lineIV = bufferedReaderIV.readLine();
                if (lineIV != null)
                    IV = IV + lineIV;
            }


            HttpsURLConnection httpsURLConnectionImage = (HttpsURLConnection) urls[3].openConnection();
            InputStream inputStreamImage = httpsURLConnectionImage.getInputStream();
            BufferedReader bufferedReaderImage = new BufferedReader(new InputStreamReader(inputStreamImage));
            String line = "";
            while (line != null) {

                line = bufferedReaderImage.readLine();
                if (line != null)
                    img = img + line;
            }

            theStrings[0]=publicKey;
            theStrings[1]=AESKey;
            theStrings[2]=IV;
            theStrings[3]=img;

            return theStrings;

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }