Archive for November, 2007

J2ME Encryption with Bouncy Castle

import org.bouncycastle.crypto.*;import org.bouncycastle.crypto.engines.*;import org.bouncycastle.crypto.modes.*;import org.bouncycastle.crypto.params.*;
public class Encryptor {
private BufferedBlockCipher cipher;private KeyParameter key;
// inisialisasi engine kriptografi.// array key paling sedikit 8 bytes.public Encryptor( byte[] key ){cipher = new PaddedBlockCipher(new CBCBlockCipher(new DESEngine() ) );this.key = new KeyParameter( key );}
// inisialisasi engine kriptografi.// string paling sedikit 8 chars.public Encryptor( String key ){this( key.getBytes() );}
private byte[] callCipher( byte[] data […]