Java Reference
In-Depth Information
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.bouncycastle.util.encoders.*;
import org.bouncycastle.crypto.*;
import org.bouncycastle.crypto.engines.*;
import org.bouncycastle.crypto.modes.*;
import org.bouncycastle.crypto.params.*;
public class BlowFishMidp extends MIDlet implements CommandListener {
private Display display = null;
private boolean encrypted = false;
private String key = "abcdefghijklmnopqrstuvwxyz0123456789";
private String text = "J2ME Crypto";
private BufferedBlockCipher bfCipher = null;
private Form mainForm = null;
private StringItem statusItem = new StringItem ("Status = ",
"init");
private StringItem keyItem = new StringItem ("Key = ", key);
private StringItem textItem = new StringItem ("Text = ", text);
public static Command encrypt = new Command ("Encrypt",
Command.SCREEN, 1);
public static Command decrypt = new Command ("Decrypt",
Command.SCREEN, 2);
public BlowFishMidp() throws CryptoException {
mainForm = new Form("BlowfishMidp");
mainForm.append (statusItem);
mainForm.append (textItem);
mainForm.append (keyItem);
mainForm.addCommand (encrypt);
mainForm.addCommand (decrypt);
mainForm.setCommandListener(this);
}
public void startApp() {
display = Display.getDisplay(this);
display.setCurrent(mainForm);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction (Command c, Displayable d) {
Search WWH ::




Custom Search