Package org.geysermc.floodgate.crypto
Class AesCipher
java.lang.Object
org.geysermc.floodgate.crypto.AesCipher
- All Implemented Interfaces:
FloodgateCipher
-
Field Summary
Fields inherited from interface org.geysermc.floodgate.crypto.FloodgateCipher
HEADER, IDENTIFIER, VERSION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
decrypt(byte[] cipherTextWithIv)
Decrypts the given data using the Key provided inFloodgateCipher.init(Key)
byte[]
encrypt(byte[] data)
Encrypts the given data using the Key provided inFloodgateCipher.init(Key)
void
Initializes the instance by giving it the key it needs to encrypt or decrypt dataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.geysermc.floodgate.crypto.FloodgateCipher
checkHeader, decryptFromString, decryptToString, encryptFromString
-
Field Details
-
IV_LENGTH
public static final int IV_LENGTH- See Also:
- Constant Field Values
-
-
Constructor Details
-
AesCipher
public AesCipher()
-
-
Method Details
-
init
Description copied from interface:FloodgateCipher
Initializes the instance by giving it the key it needs to encrypt or decrypt data- Specified by:
init
in interfaceFloodgateCipher
- Parameters:
key
- the key used to encrypt and decrypt data
-
encrypt
Description copied from interface:FloodgateCipher
Encrypts the given data using the Key provided inFloodgateCipher.init(Key)
- Specified by:
encrypt
in interfaceFloodgateCipher
- Parameters:
data
- the data to encrypt- Returns:
- the encrypted data
- Throws:
Exception
- when the encryption failed
-
decrypt
Description copied from interface:FloodgateCipher
Decrypts the given data using the Key provided inFloodgateCipher.init(Key)
- Specified by:
decrypt
in interfaceFloodgateCipher
- Parameters:
cipherTextWithIv
- the data to decrypt- Returns:
- the decrypted data
- Throws:
Exception
- when the decrypting failed
-