Class RawCipherSupport

java.lang.Object
dev.frostlake.functions.scalar.crypto.RawCipherSupport

public final class RawCipherSupport extends Object
Shared helpers for the raw-key EncryptRaw / DecryptRaw AES-GCM functions: hex BINARY conversion (the engine represents BINARY as an uppercase hex string) and the encryption-method guard.
  • Field Details

    • GCM_TAG_BITS

      public static final int GCM_TAG_BITS
      GCM authentication-tag length used by ENCRYPT_RAW / DECRYPT_RAW, in bits and bytes.
      See Also:
    • GCM_TAG_BYTES

      public static final int GCM_TAG_BYTES
      See Also:
  • Method Details

    • requireGcm

      public static void requireGcm(String function, Object method)
      Reject anything but AES-GCM. A null method is the Snowflake default (AES-GCM); any explicit method that does not name the GCM mode is refused so that an unsupported mode fails loudly rather than being silently mis-encrypted.
    • binaryBytes

      public static byte[] binaryBytes(String function, Object arg)
      Read a BINARY argument's bytes. Snowflake types the crypto arguments (plaintext/ciphertext, key, IV, AAD, tag) as BINARY and rejects a VARCHAR with "Invalid argument types" — a hex string is NOT silently accepted. A byte[] is tolerated (an already-unwrapped BINARY).
    • hexToBytes

      public static byte[] hexToBytes(String function, String hex)
      Decode an uppercase-or-lowercase hex BINARY string to bytes.
    • bytesToHex

      public static String bytesToHex(byte[] bytes)
      Encode bytes as an uppercase hex BINARY string, matching the engine's BINARY rendering.