public class AESEncryption extends Object implements PacketEncryption
| Constructor and Description |
|---|
AESEncryption(Key key)
Creates a new AESEncryption instance.
|
| Modifier and Type | Method and 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 |
getDecryptOutputSize(int length)
Gets the output size from decrypting.
|
int |
getEncryptOutputSize(int length)
Gets the output size from encrypting.
|
public AESEncryption(Key key) throws GeneralSecurityException
key - Key to use when encrypting/decrypting data.GeneralSecurityException - If a security error occurs.public int getDecryptOutputSize(int length)
PacketEncryptiongetDecryptOutputSize in interface PacketEncryptionlength - Length of the data being decrypted.public int getEncryptOutputSize(int length)
PacketEncryptiongetEncryptOutputSize in interface PacketEncryptionlength - Length of the data being encrypted.public int decrypt(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws Exception
PacketEncryptiondecrypt in interface PacketEncryptioninput - 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.Exception - If an error occurs.public int encrypt(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws Exception
PacketEncryptionencrypt in interface PacketEncryptioninput - 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.Exception - If an error occurs.Copyright © 2022. All rights reserved.