is.logi.crypto.modes
Class EncryptMode
java.lang.Object
|
+--is.logi.crypto.Crypto
|
+--is.logi.crypto.modes.EncryptMode
- Direct Known Subclasses:
- EncryptCBC, EncryptCFB, EncryptECB, EncryptOFB
- public abstract class EncryptMode
- extends Crypto
Descendants of EncryptMode encrypt arbtrarily large arrays of
plaintext. A corresponding DecryptMode should be used for
decryption.
Most EncryptModes use a CipherKey object to do actual
encryption and do additional computations to mask repetitions in
the plaintext.
- Author:
- Logi Ragnarsson
(logir@hi.is)
- See Also:
DecryptMode
Method Summary |
abstract byte[] |
encrypt(byte[] source,
int i,
int length)
Send bytes to the EncryptMode for encryption. |
abstract byte[] |
flush()
Pads the internal buffer, encrypts it and returns the
ciphertext. |
byte[] |
flush(byte[] source,
int i,
int length)
Equivalent to calling encrypt(source,i,length)
followed by flush() . |
abstract CipherKey |
getKey()
Return the key used for encryption. |
abstract void |
setKey(CipherKey key)
Set the key to use for encryption. |
Methods inherited from class is.logi.crypto.Crypto |
binString,
binString,
equal,
equalRelaxed,
equalSub,
fromHexNibble,
fromHexString,
fromString,
fromString,
hexString,
hexString,
hexString,
hexString,
makeClass,
makeInt,
makeLong,
makeSessionKey,
pastSpace,
pickBits,
pickBits,
readInt,
writeBytes,
writeBytes,
writeInt |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
EncryptMode
public EncryptMode()
getKey
public abstract CipherKey getKey()
- Return the key used for encryption.
setKey
public abstract void setKey(CipherKey key)
- Set the key to use for encryption. Do not call this method when
there may be data in the internal buffer.
flush
public abstract byte[] flush()
- Pads the internal buffer, encrypts it and returns the
ciphertext.
flush
public byte[] flush(byte[] source,
int i,
int length)
- Equivalent to calling
encrypt(source,i,length)
followed by flush()
.
encrypt
public abstract byte[] encrypt(byte[] source,
int i,
int length)
- Send bytes to the EncryptMode for encryption.
Encrypt length
bytes from source
,
starting at i
and return the ciphertext. Data may be
encrypted in blocks in which case only whole blocks of ciphertext
are written to dest
. Any remaining plaintext will be
stored and prepended to source
in the next call to
encrypt
.
Copyright 1997-1999 Logi Ragnarsson