Skip to content

Decryptor

java
public class Decryptor extends Encryption

This class is used to decrypt an encrypted String. This class extends Encryption

TIP

When using this, ensure that it is possible to provide the salt and IV that was used to encrypt the encrypted String.

Constructor

java
public Decryptor(byte[] salt, byte[] iv)

This constructor initalizes Encryption's salt to salt and IV to iv. initKey() is afterwards.

java
public Decryptor(String saltIV)

This constructor takes a concatenation of the encrypted String's salt and IV in the form of a String. salt and iv are initialized to new byte[16]. extractSaltIV() is then called to extract the salt and iv from saltIV. initKey() is afterwards.

Methods

decrypt()

java
public String decrypt(String data)

Decrypts the encrypted data using a Cipher. Returns the decrypted form of data

extractSaltIV()

java
private void extractSaltIV(String saltIV, byte[] salt_dest, byte[] iv_dest)

This separates the salt and IV from saltIV and stores them to the salt_dest and iv_dest arrays.