public class PKCS5 extends PaddingScheme
...
An IllegalBlockSizeException is thrown (by the Cipher class) if the block size is not 8 bytes.
References:
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.7 $
blockSize| Constructor and Description |
|---|
PKCS5()
Creates a PKCS5 object.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
engineIsValidBlockSize(int size)
SPI: Returns true if size is a valid block size (in
bytes) for this algorithm.
|
protected int |
enginePad(byte[] in,
int offset,
int length)
Pads a given array of bytes.
|
protected int |
engineUnpad(byte[] in,
int offset,
int length)
Given the specified subarray of bytes that includes padding bytes, returns
the index indicating where padding starts.
|
clone, engineGetParameter, engineSetBlockSize, engineSetParameter, getAlgorithm, getAlgorithms, getAlgorithms, getBlockSize, getInstance, getInstance, getParameter, pad, paddingScheme, padLength, setParameter, toString, unpadprotected int enginePad(byte[] in,
int offset,
int length)
in[offset+length..offset+7].enginePad in class PaddingSchemein - the buffer containing the incomplete block.offset - the offset into the in buffer of the
first byte in the group of bytes to be padded.length - the number of bytes from the in buffer,
starting at offset, that need to be padded.protected int engineUnpad(byte[] in,
int offset,
int length)
For PKCS#5, the padding bytes all have value
8 - (length % 8). Hence to find the number
of added bytes, it's enough to consider the last byte value of the
padded message.
engineUnpad in class PaddingSchemein - the buffer containing the bytes.offset - the offset into the in buffer of the
first byte in the block.length - the length of the block in bytes.CryptixException - if the number of padding bytes is invalid.protected boolean engineIsValidBlockSize(int size)
For PKCS#5 padding, the only valid size is 8 bytes.
engineIsValidBlockSize in class PaddingScheme