Interface PacketEncryption
- All Known Implementing Classes:
AESEncryption
public interface PacketEncryption
An interface for encrypting packets.
-
Method Summary
Modifier and TypeMethodDescriptionintdecrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) Decrypts the given data.intencrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) Encrypts the given data.intgetDecryptOutputSize(int length) Gets the output size from decrypting.intgetEncryptOutputSize(int length) Gets the output size from encrypting.
-
Method Details
-
getDecryptOutputSize
int getDecryptOutputSize(int length) Gets the output size from decrypting.- Parameters:
length- Length of the data being decrypted.- Returns:
- The output size from decrypting.
-
getEncryptOutputSize
int getEncryptOutputSize(int length) Gets the output size from encrypting.- Parameters:
length- Length of the data being encrypted.- Returns:
- The output size from encrypting.
-
decrypt
int decrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws Exception Decrypts the given data.- Parameters:
input- Input data to decrypt.inputOffset- Offset of the data to start decrypting at.inputLength- Length of the data to be decrypted.output- Array to output decrypted data to.outputOffset- Offset of the output array to start at.- Returns:
- The number of bytes stored in the output array.
- Throws:
Exception- If an error occurs.
-
encrypt
int encrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws Exception Encrypts the given data.- Parameters:
input- Input data to encrypt.inputOffset- Offset of the data to start encrypting at.inputLength- Length of the data to be encrypted.output- Array to output encrypted data to.outputOffset- Offset of the output array to start at.- Returns:
- The number of bytes stored in the output array.
- Throws:
Exception- If an error occurs.
-