org.bouncycastle.tls.crypto.TlsCipher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bctls-fips Show documentation
Show all versions of bctls-fips Show documentation
The Bouncy Castle Java APIs for the TLS, including a JSSE provider. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.
package org.bouncycastle.tls.crypto;
import java.io.IOException;
/**
* Base interface for a TLS cipher suite.
*/
public interface TlsCipher
{
/**
* Return the maximum size for the ciphertext given plaintextlimit bytes of plaintext.
* @param plaintextLimit the maximum number of bytes of plaintext.
* @return the maximum size of the ciphertext for plaintextlimit bytes of input.
*/
int getCiphertextLimit(int plaintextLimit);
/**
* Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext.
* @param ciphertextLimit the maximum number of bytes of ciphertext.
* @return the maximum size of the plaintext for ciphertextlimit bytes of input.
*/
int getPlaintextLimit(int ciphertextLimit);
/**
* Encrypt and MAC the passed in plain text using the current cipher suite.
*
* @param seqNo sequence number of the message represented by plaintext.
* @param type content type of the message represented by plaintext.
* @param plaintext array holding input plain text to the cipher.
* @param offset offset into input array the plain text starts at.
* @param len length of the plaintext in the array.
* @return the resulting cipher text.
* @throws IOException
*/
byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len)
throws IOException;
/**
* Validate and decrypt the passed in cipher text using the current cipher suite.
*
* @param seqNo sequence number of the message represented by ciphertext.
* @param type content type of the message represented by ciphertext.
* @param ciphertext array holding input cipher text to the cipher.
* @param offset offset into input array the cipher text starts at.
* @param len length of the cipher text in the array.
* @return the resulting plaintext.
* @throws IOException
*/
byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len)
throws IOException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy