Package net.overburn.redfort.devices
Class Scrambler
java.lang.Object
net.overburn.redfort.devices.Scrambler
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decrypt(String cipherText, SecretKeySpec key) byte[]decrypt(String cipherText, SecretKeySpec key, String iv) encrypt(byte[] clearBytes, SecretKeySpec key) 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
-
Field Details
-
CHACHA20_POLY1305
- See Also:
-
AES_GCM_256
- See Also:
-
IV_LENGTH
public static final int IV_LENGTH- See Also:
-
CIPHER_TEXT_DELIMITER
- See Also:
-
CIPHER_TEXT_DELIMITER_REGEX
- See Also:
-
-
Constructor Details
-
Scrambler
-
Scrambler
public Scrambler()
-
-
Method Details
-
getCipherSuite
-
encrypt
-
encrypt
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 encryptedkey- base64 encoded keyiv- init vector- Returns:
- byte[] encrypted payload
-
decrypt
-
decrypt
-