Class AesCipher

java.lang.Object
org.geysermc.floodgate.crypto.AesCipher
All Implemented Interfaces:
FloodgateCipher

public final class AesCipher extends Object implements FloodgateCipher
  • Field Details

  • Constructor Details

    • AesCipher

      public AesCipher()
  • Method Details

    • init

      public void init(Key key)
      Description copied from interface: FloodgateCipher
      Initializes the instance by giving it the key it needs to encrypt or decrypt data
      Specified by:
      init in interface FloodgateCipher
      Parameters:
      key - the key used to encrypt and decrypt data
    • encrypt

      public byte[] encrypt(byte[] data) throws Exception
      Description copied from interface: FloodgateCipher
      Encrypts the given data using the Key provided in FloodgateCipher.init(Key)
      Specified by:
      encrypt in interface FloodgateCipher
      Parameters:
      data - the data to encrypt
      Returns:
      the encrypted data
      Throws:
      Exception - when the encryption failed
    • decrypt

      public byte[] decrypt(byte[] cipherTextWithIv) throws Exception
      Description copied from interface: FloodgateCipher
      Decrypts the given data using the Key provided in FloodgateCipher.init(Key)
      Specified by:
      decrypt in interface FloodgateCipher
      Parameters:
      cipherTextWithIv - the data to decrypt
      Returns:
      the decrypted data
      Throws:
      Exception - when the decrypting failed