
I want to ask you 2 question.
First question:
I want to build an encryption application in Android. I recognized in Android that has 2 useful library: javax.crypto, java.security. Are they from JDK of java? And if yes, they are from jdk 1.5 or jdk 1.6? On the other hand, when I run Cipher.getMaxAllowedKeyLength(“RC2”); but it always returns Integer max value with any argument (RC2 is only example). When I run in Java (NetBean Enviroment 5.5.1), Cipher.getMaxAllowedKeyLength(“RC2”) run ‘OK’ (return 128 with RC2). I don’t know what happened. I suppose virtual machine (dalvik) or SDK has some errors but not sure.Code below is ‘Ok’ for java(return 128) but not OK for android (return int max value).
Using java Syntax Highlighting
- import java.security.NoSuchAlgorithmException;
- import javax.crypto.Cipher;
- import javax.crypto.NoSuchPaddingException;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TextView;
- public class Security extends Activity {
- /** Called when the activity is first created. */
- String maxkeysize= "";
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- TextView t = new TextView(this);
- initData();
- t.setText(maxkeysize);
- setContentView(t);
- }
- void initData()
- {
- try {
- int imaxkeysize = Cipher.getMaxAllowedKeyLength("RC2");
- maxkeysize = "Size is: " + imaxkeysize;
- maxkeysize +="n";
- maxkeysize += Integer.MAX_VALUE;
- Cipher des;
- try {
- des = Cipher.getInstance("DES");
- maxkeysize +=des.getAlgorithm();
- maxkeysize += " " + des.getBlockSize();
- } catch (NoSuchPaddingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- maxkeysize = e.toString();
- }
- }
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
Second question
Has Android a mechanism plugin. In android, for example, has contact application. Can I ‘add’ a function as plugin for contact application???
Please reply me fast (I'm really hurry)
Thank you very much


