Class AESEncryption

java.lang.Object
org.geysermc.mcprotocollib.network.crypt.AESEncryption
All Implemented Interfaces:
PacketEncryption

public class AESEncryption extends Object implements PacketEncryption
An encryption implementation using "AES/CFB8/NoPadding" encryption.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new AESEncryption instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    decrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
    Decrypts the given data.
    int
    encrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
    Encrypts the given data.
    int
    Gets the output size from decrypting.
    int
    Gets the output size from encrypting.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getDecryptOutputSize

      public int getDecryptOutputSize(int length)
      Description copied from interface: PacketEncryption
      Gets the output size from decrypting.
      Specified by:
      getDecryptOutputSize in interface PacketEncryption
      Parameters:
      length - Length of the data being decrypted.
      Returns:
      The output size from decrypting.
    • getEncryptOutputSize

      public int getEncryptOutputSize(int length)
      Description copied from interface: PacketEncryption
      Gets the output size from encrypting.
      Specified by:
      getEncryptOutputSize in interface PacketEncryption
      Parameters:
      length - Length of the data being encrypted.
      Returns:
      The output size from encrypting.
    • decrypt

      public int decrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws Exception
      Description copied from interface: PacketEncryption
      Decrypts the given data.
      Specified by:
      decrypt in interface PacketEncryption
      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

      public int encrypt(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws Exception
      Description copied from interface: PacketEncryption
      Encrypts the given data.
      Specified by:
      encrypt in interface PacketEncryption
      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.