Package org.geysermc.floodgate.crypto
Class AesCipher
- java.lang.Object
-
- org.geysermc.floodgate.crypto.AesCipher
-
- All Implemented Interfaces:
FloodgateCipher
public final class AesCipher extends java.lang.Object implements FloodgateCipher
-
-
Field Summary
Fields Modifier and Type Field Description static intIV_LENGTH-
Fields inherited from interface org.geysermc.floodgate.crypto.FloodgateCipher
HEADER, IDENTIFIER, VERSION
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]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)voidinit(java.security.Key key)Initializes the instance by giving it the key it needs to encrypt or decrypt data-
Methods 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 Detail
-
IV_LENGTH
public static final int IV_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AesCipher
public AesCipher(Topping topping)
-
-
Method Detail
-
init
public void init(java.security.Key key)
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
public byte[] encrypt(byte[] data) throws java.lang.ExceptionDescription 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:
java.lang.Exception- when the encryption failed
-
decrypt
public byte[] decrypt(byte[] cipherTextWithIv) throws java.lang.ExceptionDescription 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:
java.lang.Exception- when the decrypting failed
-
-