Top Fields Constructors Methods
org.bouncycastle.tls.crypto.impl.bc

pack-priv final Class BcTlsBlockCipherImpl

extends Object
implements TlsBlockCipherImpl
Class Inheritance
All Implemented Interfaces
org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl
Imports
org.bouncycastle.crypto.BlockCipher, org.bouncycastle.crypto.params.KeyParameter, .ParametersWithIV, org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl

Field Summary

Modifier and TypeField and Description
private final BlockCipher
private final boolean
private KeyParameter

Constructor Summary

AccessConstructor and Description
pack-priv
BcTlsBlockCipherImpl(BlockCipher cipher, boolean isEncrypting)

Method Summary

Modifier and TypeMethod and Description
public int
doFinal(byte[]
array holding input data to the cipher.
input
,
int
offset into input array data starts at.
inputOffset
,
int
length of the input data in the array.
inputLength
,
byte[]
array to hold the cipher output.
output
,
int
offset into output array to start saving output.
outputOffset
)

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.doFinal.

Perform the cipher encryption/decryption returning the output in output.

public int
getBlockSize()

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.getBlockSize.

Return the blocksize (in bytes) of the underlying block cipher.

public void
init(byte[]
array holding the initialization vector (IV).
iv
,
int
offset into the array the IV starts at.
ivOff
,
int
length of the IV in the array.
ivLen
)

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.init.

Initialise the parameters for operator.

public void
setKey(byte[]
array holding the block cipher key.
key
,
int
offset into the array the key starts at.
keyOff
,
int
length of the key in the array.
keyLen
)

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.setKey.

Set the key to be used by the block cipher implementation supporting this service.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherback to summary
private final BlockCipher cipher
isEncryptingback to summary
private final boolean isEncrypting
keyback to summary
private KeyParameter key

Constructor Detail

BcTlsBlockCipherImplback to summary
pack-priv BcTlsBlockCipherImpl(BlockCipher cipher, boolean isEncrypting)

Method Detail

doFinalback to summary
public int doFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.doFinal.

Doc from org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.doFinal.

Perform the cipher encryption/decryption returning the output in output.

Note

we have to use doFinal() here as it is the only way to guarantee output from the underlying cipher.

Parameters
input:byte[]

array holding input data to the cipher.

inputOffset:int

offset into input array data starts at.

inputLength:int

length of the input data in the array.

output:byte[]

array to hold the cipher output.

outputOffset:int

offset into output array to start saving output.

Returns:int

the amount of data written to output.

getBlockSizeback to summary
public int getBlockSize()

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.getBlockSize.

Doc from org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.getBlockSize.

Return the blocksize (in bytes) of the underlying block cipher.

Returns:int

the cipher's blocksize.

initback to summary
public void init(byte[] iv, int ivOff, int ivLen)

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.init.

Doc from org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.init.

Initialise the parameters for operator.

Parameters
iv:byte[]

array holding the initialization vector (IV).

ivOff:int

offset into the array the IV starts at.

ivLen:int

length of the IV in the array.

setKeyback to summary
public void setKey(byte[] key, int keyOff, int keyLen)

Implements org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.setKey.

Doc from org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl.setKey.

Set the key to be used by the block cipher implementation supporting this service.

Parameters
key:byte[]

array holding the block cipher key.

keyOff:int

offset into the array the key starts at.

keyLen:int

length of the key in the array.