Package org.bouncycastle.tls.crypto
Interface TlsCipher
-
- All Known Implementing Classes:
TlsAEADCipher
,TlsBlockCipher
,TlsNullCipher
,TlsNullNullCipher
public interface TlsCipher
Base interface for a TLS cipher suite.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len)
Validate and decrypt the passed in cipher text using the current cipher suite.byte[]
encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len)
Encrypt and MAC the passed in plain text using the current cipher suite.int
getCiphertextLimit(int plaintextLimit)
Return the maximum size for the ciphertext given plaintextlimit bytes of plaintext.int
getPlaintextLimit(int ciphertextLimit)
Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext.
-
-
-
Method Detail
-
getCiphertextLimit
int getCiphertextLimit(int plaintextLimit)
Return the maximum size for the ciphertext given plaintextlimit bytes of plaintext.- Parameters:
plaintextLimit
- the maximum number of bytes of plaintext.- Returns:
- the maximum size of the ciphertext for plaintextlimit bytes of input.
-
getPlaintextLimit
int getPlaintextLimit(int ciphertextLimit)
Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext.- Parameters:
ciphertextLimit
- the maximum number of bytes of ciphertext.- Returns:
- the maximum size of the plaintext for ciphertextlimit bytes of input.
-
encodePlaintext
byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len) throws java.io.IOException
Encrypt and MAC the passed in plain text using the current cipher suite.- Parameters:
seqNo
- sequence number of the message represented by plaintext.type
- content type of the message represented by plaintext.plaintext
- array holding input plain text to the cipher.offset
- offset into input array the plain text starts at.len
- length of the plaintext in the array.- Returns:
- the resulting cipher text.
- Throws:
java.io.IOException
-
decodeCiphertext
byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len) throws java.io.IOException
Validate and decrypt the passed in cipher text using the current cipher suite.- Parameters:
seqNo
- sequence number of the message represented by ciphertext.type
- content type of the message represented by ciphertext.ciphertext
- array holding input cipher text to the cipher.offset
- offset into input array the cipher text starts at.len
- length of the cipher text in the array.- Returns:
- the resulting plaintext.
- Throws:
java.io.IOException
-
-