Package com.mku.salmon
Class SalmonGenerator
java.lang.Object
com.mku.salmon.SalmonGenerator
Utility class that generates secure random byte arrays.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Should be 16 for AES256 the same as the iv.static final int
Chunk size format length.static final int
HASH Key length for integrity, currently we use HMAC SHA256.static final int
Hash signature size for integrity, currently we use HMAC SHA256.static final int
Encryption key length for AES256.static final int
Lenght for the magic bytes.static final int
Nonce size.static final byte
Version.static final int
Length for the Version in the data header. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
Gets the fixed magic bytes arraystatic byte[]
getSecureRandomBytes
(int size) Returns a secure random byte array.static byte
Returns the current Salmon format version.
-
Field Details
-
VERSION
public static final byte VERSIONVersion.- See Also:
-
MAGIC_LENGTH
public static final int MAGIC_LENGTHLenght for the magic bytes.- See Also:
-
VERSION_LENGTH
public static final int VERSION_LENGTHLength for the Version in the data header.- See Also:
-
BLOCK_SIZE
public static final int BLOCK_SIZEShould be 16 for AES256 the same as the iv.- See Also:
-
KEY_LENGTH
public static final int KEY_LENGTHEncryption key length for AES256.- See Also:
-
HASH_KEY_LENGTH
public static final int HASH_KEY_LENGTHHASH Key length for integrity, currently we use HMAC SHA256.- See Also:
-
HASH_RESULT_LENGTH
public static final int HASH_RESULT_LENGTHHash signature size for integrity, currently we use HMAC SHA256.- See Also:
-
NONCE_LENGTH
public static final int NONCE_LENGTHNonce size.- See Also:
-
CHUNK_SIZE_LENGTH
public static final int CHUNK_SIZE_LENGTHChunk 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.
-