anon.client.crypto
Class SymCipher

java.lang.Object
  extended by anon.client.crypto.SymCipher

public class SymCipher
extends java.lang.Object


Field Summary
(package private)  org.bouncycastle.crypto.engines.AESFastEngine m_aesEngine1
           
(package private)  org.bouncycastle.crypto.engines.AESFastEngine m_aesEngine2
           
(package private)  byte[] m_aesKeys
           
(package private)  byte[] m_iv1
           
(package private)  byte[] m_iv2
           
 
Constructor Summary
SymCipher()
           
 
Method Summary
 int encryptAES1(byte[] from, int ifrom, byte[] to, int ito, int len)
           
 int encryptAES2(byte[] buff)
           
 byte[] getKeys()
          Returns the currently used key(s) for encryption.
 int setEncryptionKeyAES(byte[] key)
           
 int setEncryptionKeyAES(byte[] key, int offset, int len)
           
 int setEncryptionKeysAES(byte[] keys)
          Set both keys to different value, if keys.length==2* KEY_SIZe, else set both keys to the same value
 void setIV2(byte[] buff)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_aesEngine1

org.bouncycastle.crypto.engines.AESFastEngine m_aesEngine1

m_aesEngine2

org.bouncycastle.crypto.engines.AESFastEngine m_aesEngine2

m_iv1

byte[] m_iv1

m_iv2

byte[] m_iv2

m_aesKeys

byte[] m_aesKeys
Constructor Detail

SymCipher

public SymCipher()
Method Detail

setEncryptionKeyAES

public int setEncryptionKeyAES(byte[] key)

setEncryptionKeyAES

public int setEncryptionKeyAES(byte[] key,
                               int offset,
                               int len)
Parameters:
key - byte[]
offset - int
len - int if len==16 --> only the key is set; if len==32 --> key and IV is set
Returns:
int

setEncryptionKeysAES

public int setEncryptionKeysAES(byte[] keys)
Set both keys to different value, if keys.length==2* KEY_SIZe, else set both keys to the same value

Parameters:
keys - byte[]
Returns:
int

getKeys

public byte[] getKeys()
Returns the currently used key(s) for encryption. If both keys are set, than an array of 32 byte is returned, otherwise an array of 16 bytes

Returns:
The current key(s) used for encryption or null, if no key is set.

setIV2

public void setIV2(byte[] buff)

encryptAES1

public int encryptAES1(byte[] from,
                       int ifrom,
                       byte[] to,
                       int ito,
                       int len)

encryptAES2

public int encryptAES2(byte[] buff)