Class Scrambler

java.lang.Object
net.overburn.redfort.devices.Scrambler

public class Scrambler extends Object
Encrypts and Decrypts data via Symmetric Encryption Cipher Suites. WARNING: Stick to ChaCha20-Poly1305 defaults and avoid modifying/implementing this or any implementations without understanding the ramifications. For further info see:
See Also:
  • Field Details

  • Constructor Details

    • Scrambler

      public Scrambler(String cipherSuite)
    • Scrambler

      public Scrambler()
  • Method Details

    • getCipherSuite

      public String getCipherSuite()
    • encrypt

      public String encrypt(byte[] clearBytes, SecretKeySpec key)
    • encrypt

      public String encrypt(byte[] clearBytes, SecretKeySpec key, byte[] iv)
      Encrypts a byte array that is with the supplied key and initialized with manual or internal vector iv using a supported cipher suite
      Parameters:
      clearBytes - payload to be encrypted
      key - base64 encoded key
      iv - init vector
      Returns:
      byte[] encrypted payload
    • decrypt

      public byte[] decrypt(String cipherText, SecretKeySpec key)
    • decrypt

      public byte[] decrypt(String cipherText, SecretKeySpec key, String iv)