Top Description Constructors Methods
org.bouncycastle.crypto.internal.paddings

public Class TBCPadding

extends Object
implements BlockCipherPadding
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.paddings.BlockCipherPadding
Imports
java.security.SecureRandom, org.bouncycastle.crypto.internal.InvalidCipherTextException

A padder that adds Trailing-Bit-Compliment padding to a block.

This padding pads the block out with the compliment of the last bit of the plain text.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
addPadding(byte[] in, int inOff)

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.addPadding.

add the pad bytes to the passed in block, returning the number of bytes added.
public String

Returns:

the name of the algorithm the padder implements.
getPaddingName
()

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.getPaddingName.

Return the name of the algorithm the padder implements.
public void
init(SecureRandom
- a SecureRandom if available.
random
)

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.init.

Initialise the padder.
public int
padCount(byte[] in)

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.padCount.

return the number of pad bytes present in the block.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TBCPaddingback to summary
public TBCPadding()

Method Detail

addPaddingback to summary
public int addPadding(byte[] in, int inOff)

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.addPadding.

add the pad bytes to the passed in block, returning the number of bytes added.

Note

this assumes that the last block of plain text is always passed to it inside in. i.e. if inOff is zero, indicating the entire block is to be overwritten with padding the value of in should be the same as the last block of plain text.

getPaddingNameback to summary
public String getPaddingName()

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.getPaddingName.

Return the name of the algorithm the padder implements.

Returns:String

the name of the algorithm the padder implements.

initback to summary
public void init(SecureRandom random) throws IllegalArgumentException

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.init.

Initialise the padder.

Parameters
random:SecureRandom

- a SecureRandom if available.

padCountback to summary
public int padCount(byte[] in) throws InvalidCipherTextException

Implements org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.padCount.

return the number of pad bytes present in the block.

Exceptions
InvalidCipherTextException:

Doc from org.bouncycastle.crypto.internal.paddings.BlockCipherPadding.padCount.

if the padding is badly formed or invalid.