APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class PKCS5Padding

extends Object
implements Padding
Class Inheritance
All Implemented Interfaces
com.sun.crypto.provider.Padding
Imports
javax.crypto.ShortBufferException, java.util.Arrays

This class implements padding as specified in the PKCS#5 standard.
Author
Gigi Ankeny
See Also
Padding

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
PKCS5Padding(int blockSize)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the length of the padding
padLength
(int
the length of the data to pad
len
)

Implements com.sun.crypto.provider.Padding.padLength.

Determines how long the padding will be for a given input length.

public void
padWithLen(byte[]
the input buffer with the data to pad
in
,
int
the offset in in where the padding bytes are appended
off
,
int
the number of padding bytes to add
len
)

Implements com.sun.crypto.provider.Padding.padWithLen.

Adds the given number of padding bytes to the data input.

public int

Returns:

the index where the padding starts, or -1 if the input is not properly padded
unpad
(byte[]
the buffer with the padded data
in
,
int
the offset in in where the padded data starts
off
,
int
the length of the padded data
len
)

Implements com.sun.crypto.provider.Padding.unpad.

Returns the index where the padding starts.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockSizeback to summary
private final int blockSize

Constructor Detail

PKCS5Paddingback to summary
pack-priv PKCS5Padding(int blockSize)

Method Detail

padLengthback to summary
public int padLength(int len)

Implements com.sun.crypto.provider.Padding.padLength.

Determines how long the padding will be for a given input length.

Parameters
len:int

the length of the data to pad

Returns:int

the length of the padding

padWithLenback to summary
public void padWithLen(byte[] in, int off, int len) throws ShortBufferException

Implements com.sun.crypto.provider.Padding.padWithLen.

Adds the given number of padding bytes to the data input. The value of the padding bytes is determined by the specific padding mechanism that implements this interface.

Parameters
in:byte[]

the input buffer with the data to pad

off:int

the offset in in where the padding bytes are appended

len:int

the number of padding bytes to add

Exceptions
ShortBufferException:
if in is too small to hold the padding bytes
unpadback to summary
public int unpad(byte[] in, int off, int len)

Implements com.sun.crypto.provider.Padding.unpad.

Returns the index where the padding starts.

Given a buffer with padded data, this method returns the index where the padding starts.

Parameters
in:byte[]

the buffer with the padded data

off:int

the offset in in where the padded data starts

len:int

the length of the padded data

Returns:int

the index where the padding starts, or -1 if the input is not properly padded