Package io.aether.crypto
Interface CryptoEngine
-
- All Superinterfaces:
CryptoProviderUnit,io.aether.utils.ToString
public interface CryptoEngine extends CryptoProviderUnit
Interface for an object that performs encryption and decryption with a stateful component, such as a nonce. Implementations of this interface will hold keys and other internal state necessary for the cryptographic process.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description byte[]decrypt(byte[] data)Decrypts the provided data.default byte[]decrypt(byte[] data, byte[] associatedData)Decrypts data and verifies optional associated data.byte[]encrypt(byte[] data)Encrypts the provided data.default byte[]encrypt(byte[] data, byte[] associatedData)Encrypts data and binds optional associated data to the packet.static CryptoEngineof(CryptoEngine encoder, CryptoEngine decoder)-
Methods inherited from interface io.aether.crypto.CryptoProviderUnit
getCryptoProvider, getProviderName
-
-
-
-
Method Detail
-
encrypt
default byte[] encrypt(byte[] data, byte[] associatedData)Encrypts data and binds optional associated data to the packet. Null and empty associated data preserve the legacy wire format.
-
decrypt
default byte[] decrypt(byte[] data, byte[] associatedData)Decrypts data and verifies optional associated data. No replay, nonce or sequence tracking is performed. Packets may be decrypted repeatedly and in arbitrary order.
-
encrypt
byte[] encrypt(byte[] data)
Encrypts the provided data.- Parameters:
data- The data to be encrypted.- Returns:
- The encrypted data.
-
decrypt
byte[] decrypt(byte[] data)
Decrypts the provided data.- Parameters:
data- The data to be decrypted.- Returns:
- The decrypted data.
-
of
static CryptoEngine of(CryptoEngine encoder, CryptoEngine decoder)
-
-