Package org.bouncycastle.crypto.tls
Class TlsBlockCipher
- java.lang.Object
-
- org.bouncycastle.crypto.tls.TlsBlockCipher
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsContext
context
protected BlockCipher
decryptCipher
protected BlockCipher
encryptCipher
protected boolean
encryptThenMAC
protected byte[]
randomData
protected TlsMac
readMac
protected boolean
useExplicitIV
protected TlsMac
writeMac
-
Constructor Summary
Constructors Constructor Description TlsBlockCipher(TlsContext context, BlockCipher clientWriteCipher, BlockCipher serverWriteCipher, Digest clientWriteDigest, Digest serverWriteDigest, int cipherKeySize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
-
-
-
Field Detail
-
context
protected TlsContext context
-
randomData
protected byte[] randomData
-
useExplicitIV
protected boolean useExplicitIV
-
encryptThenMAC
protected boolean encryptThenMAC
-
encryptCipher
protected BlockCipher encryptCipher
-
decryptCipher
protected BlockCipher decryptCipher
-
writeMac
protected TlsMac writeMac
-
readMac
protected TlsMac readMac
-
-
Constructor Detail
-
TlsBlockCipher
public TlsBlockCipher(TlsContext context, BlockCipher clientWriteCipher, BlockCipher serverWriteCipher, Digest clientWriteDigest, Digest serverWriteDigest, int cipherKeySize) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getWriteMac
public TlsMac getWriteMac()
-
getReadMac
public TlsMac getReadMac()
-
getPlaintextLimit
public int getPlaintextLimit(int ciphertextLimit)
- Specified by:
getPlaintextLimit
in interfaceTlsCipher
-
encodePlaintext
public byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len)
- Specified by:
encodePlaintext
in interfaceTlsCipher
-
decodeCiphertext
public byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len) throws java.io.IOException
- Specified by:
decodeCiphertext
in interfaceTlsCipher
- 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)
-
-