Package org.bouncycastle.crypto.tls
Class TlsStreamCipher
- java.lang.Object
-
- org.bouncycastle.crypto.tls.TlsStreamCipher
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsContext
context
protected StreamCipher
decryptCipher
protected StreamCipher
encryptCipher
protected TlsMac
readMac
protected boolean
usesNonce
protected TlsMac
writeMac
-
Constructor Summary
Constructors Constructor Description TlsStreamCipher(TlsContext context, StreamCipher clientWriteCipher, StreamCipher serverWriteCipher, Digest clientWriteDigest, Digest serverWriteDigest, int cipherKeySize, boolean usesNonce)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkMAC(long seqNo, short type, byte[] recBuf, int recStart, int recEnd, byte[] calcBuf, int calcOff, int calcLen)
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)
protected void
updateIV(StreamCipher cipher, boolean forEncryption, long seqNo)
-
-
-
Field Detail
-
context
protected TlsContext context
-
encryptCipher
protected StreamCipher encryptCipher
-
decryptCipher
protected StreamCipher decryptCipher
-
writeMac
protected TlsMac writeMac
-
readMac
protected TlsMac readMac
-
usesNonce
protected boolean usesNonce
-
-
Constructor Detail
-
TlsStreamCipher
public TlsStreamCipher(TlsContext context, StreamCipher clientWriteCipher, StreamCipher serverWriteCipher, Digest clientWriteDigest, Digest serverWriteDigest, int cipherKeySize, boolean usesNonce) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
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
-
checkMAC
protected void checkMAC(long seqNo, short type, byte[] recBuf, int recStart, int recEnd, byte[] calcBuf, int calcOff, int calcLen) throws java.io.IOException
- Throws:
java.io.IOException
-
updateIV
protected void updateIV(StreamCipher cipher, boolean forEncryption, long seqNo)
-
-