Please let me know if you were able to find good documentation for Android Encryption. We are working on this right now. We are using Jt components to do the encryption/decryption. We just need to include the appropriate settings for the properties file:
! Jt Asymmetric Cipher Jt.security.JtAsymmetricCipher.certificateName:Jt Jt.security.JtAsymmetricCipher.transformation:RSA/ECB/PKCS1Padding ! Jt Symmetric Cipher Jt.security.JtSymmetricCipher.algorithm:Blowfish Jt.security.JtSymmetricCipher.transformation:Blowfish/ECB/PKCS5Padding Jt.security.JtSymmetricCipher.keySize:128 I'd like to know what Encryption algorithms are available/supported within the Android distribution (no third party) Blowfish (default) causes an exception. Thanks in advance, On Sep 24, 4:44 am, "[email protected]" <[email protected]> wrote: > 0 down vote favorite > > I am trying to to download and decrypt an encrypted XML file. > > I have implemented the download part and have tested with an > unencrypted file and it works fine. > > However I now need to be able to download an XML file that has been > encrypted using AES and the key "XXXX" > > So I am only concerned with decryption as theencryptionon the XML > file is already done. > > Here is my code so far: > > public NodeList getXMLDoc(){ > URL url; > NodeList nl = null; > > try{ > String xmlFeed = context.getString(R.string.xml_feed); > try { > url = new URL(xmlFeed); > URLConnection urlConnection; > urlConnection = url.openConnection(); > HttpURLConnection httpConnection = (HttpURLConnection) > urlConnection; > int responseCode = httpConnection.getResponseCode(); > > if(responseCode == HttpURLConnection.HTTP_OK){ > > String bytes = toHex("XXXX"); > SecretKeySpec skeySpec = new > SecretKeySpec(toByte(bytes), "AES"); > try { > c.init(Cipher.DECRYPT_MODE, skeySpec); > //c.doFinal(); > } catch (InvalidKeyException e) { > e.printStackTrace(); > } > InputStream in = httpConnection.getInputStream(); > CipherInputStream cis = new CipherInputStream(in, > c); > DocumentBuilderFactory dbf; > dbf = DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > > Document dom = db.parse(cis); > > Element docEle = dom.getDocumentElement(); > > nl = docEle.getElementsByTagName(TAG_CHAR); > > } > } > catch (MalformedURLException e) { > > e.printStackTrace(); > } > catch (IOException e) { > > e.printStackTrace(); > } catch (ParserConfigurationException e) { > > e.printStackTrace(); > } catch (SAXException e) { > > e.printStackTrace(); > } > } > finally{ > > } > return nl; > } > > At the minute I am trying to decrypt the whole file using > CipherInputStream is this the correct approach? > > My code above gives me the following exception: > > WARN/System.err(5274): java.io.IOException: last block incomplete in > decryption > > Is this a setup error or what might be causing this error? > > Are there any tutorials on how to decrypt an XML file in Android/Java? > > Am I going in the right direction as to how to decrypt the file or is > my code completely wrong? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

