org.bouncycastle.crypto.tls
Class TlsBlockCipher
java.lang.Object
org.bouncycastle.crypto.tls.TlsBlockCipher
- All Implemented Interfaces:
- TlsCipher
public class TlsBlockCipher
- extends java.lang.Object
- implements TlsCipher
A generic TLS 1.0-1.1 / SSLv3 block cipher. This can be used for AES or 3DES for example.
Method Summary |
protected int |
checkPaddingConstantTime(byte[] buf,
int off,
int len,
int blockSize,
int macSize)
|
protected int |
chooseExtraPadBlocks(java.security.SecureRandom r,
int max)
|
byte[] |
decodeCiphertext(long seqNo,
short type,
byte[] ciphertext,
int offset,
int len)
|
byte[] |
encodePlaintext(long seqNo,
short type,
byte[] plaintext,
int offset,
int len)
|
int |
getPlaintextLimit(int ciphertextLimit)
|
TlsMac |
getReadMac()
|
TlsMac |
getWriteMac()
|
protected int |
lowestBitSet(int x)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
context
protected TlsContext context
randomData
protected byte[] randomData
useExplicitIV
protected boolean useExplicitIV
encryptCipher
protected BlockCipher encryptCipher
decryptCipher
protected BlockCipher decryptCipher
writeMac
protected TlsMac writeMac
readMac
protected TlsMac readMac
TlsBlockCipher
public TlsBlockCipher(TlsContext context,
BlockCipher clientWriteCipher,
BlockCipher serverWriteCipher,
Digest clientWriteDigest,
Digest serverWriteDigest,
int cipherKeySize)
throws java.io.IOException
- Throws:
java.io.IOException
getWriteMac
public TlsMac getWriteMac()
getReadMac
public TlsMac getReadMac()
getPlaintextLimit
public int getPlaintextLimit(int ciphertextLimit)
- Specified by:
getPlaintextLimit
in interface TlsCipher
encodePlaintext
public byte[] encodePlaintext(long seqNo,
short type,
byte[] plaintext,
int offset,
int len)
- Specified by:
encodePlaintext
in interface TlsCipher
decodeCiphertext
public byte[] decodeCiphertext(long seqNo,
short type,
byte[] ciphertext,
int offset,
int len)
throws java.io.IOException
- Specified by:
decodeCiphertext
in interface TlsCipher
- Throws:
java.io.IOException
checkPaddingConstantTime
protected int checkPaddingConstantTime(byte[] buf,
int off,
int len,
int blockSize,
int macSize)
chooseExtraPadBlocks
protected int chooseExtraPadBlocks(java.security.SecureRandom r,
int max)
lowestBitSet
protected int lowestBitSet(int x)