Class SalmonGenerator

java.lang.Object
com.mku.salmon.SalmonGenerator

public class SalmonGenerator extends Object
Utility class that generates secure random byte arrays.
  • Field Details

    • VERSION

      public static final byte VERSION
      Version.
      See Also:
    • MAGIC_LENGTH

      public static final int MAGIC_LENGTH
      Lenght for the magic bytes.
      See Also:
    • VERSION_LENGTH

      public static final int VERSION_LENGTH
      Length for the Version in the data header.
      See Also:
    • BLOCK_SIZE

      public static final int BLOCK_SIZE
      Should be 16 for AES256 the same as the iv.
      See Also:
    • KEY_LENGTH

      public static final int KEY_LENGTH
      Encryption key length for AES256.
      See Also:
    • HASH_KEY_LENGTH

      public static final int HASH_KEY_LENGTH
      HASH Key length for integrity, currently we use HMAC SHA256.
      See Also:
    • HASH_RESULT_LENGTH

      public static final int HASH_RESULT_LENGTH
      Hash signature size for integrity, currently we use HMAC SHA256.
      See Also:
    • NONCE_LENGTH

      public static final int NONCE_LENGTH
      Nonce size.
      See Also:
    • CHUNK_SIZE_LENGTH

      public static final int CHUNK_SIZE_LENGTH
      Chunk size format length.
      See Also:
  • Constructor Details

    • SalmonGenerator

      public SalmonGenerator()
  • Method Details

    • getMagicBytes

      public static byte[] getMagicBytes()
      Gets the fixed magic bytes array
      Returns:
      The magic bytes
    • getVersion

      public static byte getVersion()
      Returns the current Salmon format version.
      Returns:
      The version number
    • getSecureRandomBytes

      public static byte[] getSecureRandomBytes(int size)
      Returns a secure random byte array. To be used when generating keys, initial vectors, and nonces.
      Parameters:
      size - The size of the byte array.
      Returns:
      The random secure byte array.