Package com.mku.salmon
Class SalmonGenerator
java.lang.Object
com.mku.salmon.SalmonGenerator
Utility class that generates secure random byte arrays.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intShould be 16 for AES256 the same as the iv.static final intChunk size format length.static final intHASH Key length for integrity, currently we use HMAC SHA256.static final intHash signature size for integrity, currently we use HMAC SHA256.static final intEncryption key length for AES256.static final intLenght for the magic bytes.static final intNonce size.static final byteVersion.static final intLength for the Version in the data header. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Gets the fixed magic bytes arraystatic byte[]getSecureRandomBytes(int size) Returns a secure random byte array.static byteReturns 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.
-