is.logi.crypto.modes
Class DecryptCBC
java.lang.Object
|
+--is.logi.crypto.Crypto
|
+--is.logi.crypto.modes.DecryptMode
|
+--is.logi.crypto.modes.DecryptCBC
- public class DecryptCBC
- extends DecryptMode
Use this class to decrypt ciphertext generated by EncryptCBC.
If you are using symmetric keys, the DecryptECB object must be
initialized with the same key as the EncryptECB object it is
decrypting data from. If you are using asymetric keys, the DecryptECB
object must be initialized with the other key from the key-pair.
- Author:
- Logi Ragnarsson
(logir@hi.is)
- See Also:
EncryptCBC
Constructor Summary |
DecryptCBC()
Create a new CBC-mode decrypt session with no key. |
DecryptCBC(CipherKey key)
Create a new CBC-mode decrypt session with the specified key. |
Method Summary |
byte[] |
decrypt(byte[] source,
int i,
int length)
Send bytes to the DecryptCBC object for decryption. |
CipherKey |
getKey()
Return the key used for decryption. |
void |
setKey(CipherKey key)
Set the key to use for decryption. |
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 |
DecryptCBC
public DecryptCBC(CipherKey key)
- Create a new CBC-mode decrypt session with the specified key.
DecryptCBC
public DecryptCBC()
- Create a new CBC-mode decrypt session with no key. No decryption
can be performed until a call to
setKey()
has been
made.
getKey
public CipherKey getKey()
- Return the key used for decryption.
- Overrides:
- getKey in class DecryptMode
setKey
public void setKey(CipherKey key)
- Set the key to use for decryption. Do not call this method when
there may be data in the internal buffer.
- Overrides:
- setKey in class DecryptMode
decrypt
public byte[] decrypt(byte[] source,
int i,
int length)
- Send bytes to the DecryptCBC object for decryption.
Decrypt length
bytes from source
,
starting at i
and return the plaintext. Data may
be encrypted in blocks in which case only whole blocks of
plaintext are written to dest
. Any remaining data
will be stored and prepended to source
in the next
call to decrypt
.
- Overrides:
- decrypt in class DecryptMode
Copyright 1997-1999 Logi Ragnarsson