TlsStreamCipher (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.crypto.tls

## Class TlsStreamCipher

- java.lang.Object
- - org.bouncycastle.crypto.tls.TlsStreamCipher

- All Implemented Interfaces:
    TlsCipher

      public class TlsStreamCipher
      extends java.lang.Object
      implements TlsCipher

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TlsContext` | `context`
    `protected StreamCipher` | `decryptCipher`
    `protected StreamCipher` | `encryptCipher`
    `protected TlsMac` | `readMac`
    `protected boolean` | `usesNonce`
    `protected TlsMac` | `writeMac`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TlsStreamCipher(TlsContext context, StreamCipher clientWriteCipher, StreamCipher serverWriteCipher, Digest clientWriteDigest, Digest serverWriteDigest, int cipherKeySize, boolean usesNonce)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 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`

    - #### 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)