Package org.bouncycastle.crypto.tls
Class TlsStreamCipher
- java.lang.Object
-
- org.bouncycastle.crypto.tls.TlsStreamCipher
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsContextcontextprotected StreamCipherdecryptCipherprotected StreamCipherencryptCipherprotected TlsMacreadMacprotected booleanusesNonceprotected TlsMacwriteMac
-
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 voidcheckMAC(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)intgetPlaintextLimit(int ciphertextLimit)protected voidupdateIV(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:
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
-
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)
-
-