Package io.adabox.dextreme.utils
Class AESUtils
java.lang.Object
io.adabox.dextreme.utils.AESUtils
AES Utils
Used to Decrypt Responses for Minswap DEX API
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdecryptstatic Stringstatic byte[][]GenerateKeyAndIV(int keyLength, int ivLength, int iterations, byte[] salt, byte[] password, MessageDigest md) Generates a key and an initialization vector (IV) with the given salt and password.static void
-
Constructor Details
-
AESUtils
public AESUtils()
-
-
Method Details
-
setKey
-
encrypt
-
decrypt
decrypt- Parameters:
cipherText- text to decryptsecret- secret used to decrypt- Returns:
- decrypted string
-
GenerateKeyAndIV
public static byte[][] GenerateKeyAndIV(int keyLength, int ivLength, int iterations, byte[] salt, byte[] password, MessageDigest md) Generates a key and an initialization vector (IV) with the given salt and password.This method is equivalent to OpenSSL's EVP_BytesToKey function (see https://github.com/openssl/openssl/blob/master/crypto/evp/evp_key.c). By default, OpenSSL uses a single iteration, MD5 as the algorithm and UTF-8 encoded password data.
- Parameters:
keyLength- the length of the generated key (in bytes)ivLength- the length of the generated IV (in bytes)iterations- the number of digestion roundssalt- the salt data (8 bytes of data ornull)password- the password data (optional)md- the message digest algorithm to use- Returns:
- an two-element array with the generated key and IV
-