|
For the latest news and information visit The GNU Crypto project |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | 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 off,
int len)
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()
If any additional checks or resource setup must be done by the subclass, then this is the hook for it. |
abstract int |
unpad(byte[] in,
int off,
int len)
Returns the number of bytes to discard from a designated input buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
public void init(int bs) throws java.lang.IllegalStateException
IPad
init
in interface IPad
bs
- the designated block size.
java.lang.IllegalStateException
- if the instance is already initialised.public void reset()
IPad
reset
in interface IPad
public boolean selfTest()
IPad
selfTest
in interface IPad
public abstract void setup()
If any additional checks or resource setup must be done by the
subclass, then this is the hook for it. This method will be called before
the init(int)
method returns.
public abstract byte[] pad(byte[] in, int off, int len)
IPad
pad
in interface IPad
in
- the input buffer containing the bytes to pad.off
- the starting index of meaningful data in in.len
- the number of meaningful bytes in in.
public abstract int unpad(byte[] in, int off, int len) throws WrongPaddingException
IPad
unpad
in interface IPad
in
- the input buffer containing the bytes to unpad.off
- the starting index of meaningful data in in.len
- 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |