Package org.geysermc.floodgate.crypto
Class AesCipher
java.lang.Object
org.geysermc.floodgate.crypto.AesCipher
- All Implemented Interfaces:
FloodgateCipher
-
Field Summary
FieldsFields inherited from interface org.geysermc.floodgate.crypto.FloodgateCipher
HEADER, IDENTIFIER, VERSION -
Constructor Summary
Constructors -
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)voidInitializes 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, waitMethods 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:FloodgateCipherInitializes the instance by giving it the key it needs to encrypt or decrypt data- Specified by:
initin interfaceFloodgateCipher- Parameters:
key- the key used to encrypt and decrypt data
-
encrypt
Description copied from interface:FloodgateCipherEncrypts the given data using the Key provided inFloodgateCipher.init(Key)- Specified by:
encryptin interfaceFloodgateCipher- Parameters:
data- the data to encrypt- Returns:
- the encrypted data
- Throws:
Exception- when the encryption failed
-
decrypt
Description copied from interface:FloodgateCipherDecrypts the given data using the Key provided inFloodgateCipher.init(Key)- Specified by:
decryptin interfaceFloodgateCipher- Parameters:
cipherTextWithIv- the data to decrypt- Returns:
- the decrypted data
- Throws:
Exception- when the decrypting failed
-