|
For the latest news and information visit The GNU Crypto project |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.crypto.pad.BasePad
An abstract class to facilitate implementing padding algorithms.
Field Summary | |
protected int |
blockSize
The block size, in bytes, for this instance. |
protected java.lang.String |
name
The canonical name prefix of the padding algorithm. |
Constructor Summary | |
protected |
BasePad(java.lang.String name)
Trivial constructor for use by concrete subclasses. |
Method Summary | |
void |
init(int bs)
Initialises the padding scheme with a designated block size. |
java.lang.String |
name()
|
abstract byte[] |
pad(byte[] in,
int offset,
int length)
Returns the byte sequence that should be appended to the designated input. |
void |
reset()
Resets the scheme instance for re-initialisation and use with other characteristics. |
boolean |
selfTest()
A basic symmetric pad/unpad test. |
abstract void |
setup()
|
abstract int |
unpad(byte[] in,
int offset,
int length)
Returns the number of bytes to discard from a designated input buffer. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.lang.String name
protected int blockSize
Constructor Detail |
protected BasePad(java.lang.String name)
Method Detail |
public java.lang.String name()
name
in interface IPad
gnu.crypto.pad.IPad
public void init(int bs) throws java.lang.IllegalStateException
IPad
init
in interface IPad
gnu.crypto.pad.IPad
bs
- the designated block size.java.lang.IllegalStateException
- if the instance is already initialised.java.lang.IllegalArgumentException
- if the block size value is invalid.public void reset()
IPad
reset
in interface IPad
public boolean selfTest()
IPad
selfTest
in interface IPad
gnu.crypto.pad.IPad
public abstract void setup()
public abstract byte[] pad(byte[] in, int offset, int length)
IPad
pad
in interface IPad
gnu.crypto.pad.IPad
in
- the input buffer containing the bytes to pad.offset
- the starting index of meaningful data in in.length
- the number of meaningful bytes in in.public abstract int unpad(byte[] in, int offset, int length) throws WrongPaddingException
IPad
unpad
in interface IPad
gnu.crypto.pad.IPad
in
- the input buffer containing the bytes to unpad.offset
- the starting index of meaningful data in in.length
- the number of meaningful bytes in in.WrongPaddingException
- if the data is not terminated with the
expected padding bytes.
|
For the latest news and information visit The GNU Crypto project |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |