Package org.bouncycastle.crypto.tls
Class TlsBlockCipher
- java.lang.Object
-
- org.bouncycastle.crypto.tls.TlsBlockCipher
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsContextcontextprotected BlockCipherdecryptCipherprotected BlockCipherencryptCipherprotected booleanencryptThenMACprotected byte[]randomDataprotected TlsMacreadMacprotected booleanuseExplicitIVprotected TlsMacwriteMac
-
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 intcheckPaddingConstantTime(byte[] buf, int off, int len, int blockSize, int macSize)protected intchooseExtraPadBlocks(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)intgetPlaintextLimit(int ciphertextLimit)TlsMacgetReadMac()TlsMacgetWriteMac()protected intlowestBitSet(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:
getPlaintextLimitin interfaceTlsCipher
-
encodePlaintext
public byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len)- Specified by:
encodePlaintextin interfaceTlsCipher
-
decodeCiphertext
public byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len) throws java.io.IOException- Specified by:
decodeCiphertextin 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)
-
-