AES implementation

Advanced Encryption Algorithm (Rijndael)

  • two-way process of encryption and decryption with the use of a key
  • a sequence of characters serves as the key
  • encrypting data to safely store it

AES standards:

  • key lengths: 128, 192, 256 bits
  • constant block size: 128 bits

Usage

class Main{
    public static void main(String[] args){
        byte[] data = "what".getBytes();
        byte[] password = "defense".getBytes();

        byte[] encryptedBytes = Encryption.encryptData(data, password);

        byte[] decryptedBytes = Decryption.decryptData(encryptedBytes, password);
        assert new String(decryptedBytes).startsWith("what");
    }
}

sources:

image image