Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.crypto.fips.provider
Interface Padding

public interface Padding

Padding interface. This interface is implemented by general-purpose padding schemes, such as the one described in PKCS#5.

Version:
  1.10, 10/26/98
Author:
  Jan Luehe, Gigi Ankeny

Method Summary
`int` | `pad(byte[] in, int off, int len)` Performs padding for the given data input.
`int` | `padLength(int len)` Determines how long the padding will be for a given input length.
`void` | `padWithLen(byte[] in, int off, int len)` Adds the given number of padding bytes to the data input.
`int` | `unpad(byte[] in, int off, int len)` Returns the index where padding starts.

Method Detail

### pad

    public int pad(byte[] in,
                   int off,
                   int len)
            throws javax.crypto.ShortBufferException

  Performs padding for the given data input. The padding bytes are appended to the data input.
  Parameters:
    `in` - the input buffer with the data to pad
    `off` - the offset in `in` where the data to pad starts
    `len` - the length of the data to pad
  Returns:
    the number of padding bytes appended
  Throws:
    `javax.crypto.ShortBufferException` - if `in` is too small to hold the padding bytes

### padWithLen

    public void padWithLen(byte[] in,
                           int off,
                           int len)
                    throws javax.crypto.ShortBufferException

  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` - the input buffer with the data to pad
    `the` - offset in `in` where the padding bytes are appended
    `len` - the number of padding bytes to add
  Throws:
    `javax.crypto.ShortBufferException` - if `in` is too small to hold the padding bytes

### unpad

    public int unpad(byte[] in,
                     int off,
                     int len)

  Returns the index where padding starts.

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

  Parameters:
    `in` - the buffer with the data and their padding
    `off` - the offset in `in` where the data starts
    `len` - the length of the data and their padding
  Returns:
    the index where the padding starts, or -1 if the input is not properly padded

### padLength

    public int padLength(int len)

  Determines how long the padding will be for a given input length.
  Parameters:
    `len` - the length of the data to pad
  Returns:
    the length of the padding

Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD