Package com.mku.salmon
Class Header
- java.lang.Object
-
- com.mku.salmon.Header
-
public class Header extends java.lang.Object
Header embedded within the AesStream. Header contains nonce and other information for decrypting the stream.
-
-
Field Summary
Fields Modifier and Type Field Description static long
HEADER_LENGTH
Header length
-
Constructor Summary
Constructors Constructor Description Header(byte[] headerData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getChunkSize()
Get the chunk size.byte[]
getHeaderData()
Get the raw header data.byte[]
getMagicBytes()
Get the magic bytesbyte[]
getNonce()
Get the nonce.byte
getVersion()
Get the Salmon format versionstatic Header
readHeaderData(RandomAccessStream stream)
Parse the header data from the streamvoid
setChunkSize(int chunkSize)
Set the header chunk sizevoid
setNonce(byte[] nonce)
Set the nonce to be used.void
setVersion(byte version)
Set the Salmon format versionstatic Header
writeHeader(RandomAccessStream stream, byte[] nonce, int chunkSize)
-
-
-
Field Detail
-
HEADER_LENGTH
public static final long HEADER_LENGTH
Header length- See Also:
- Constant Field Values
-
-
Method Detail
-
getNonce
public byte[] getNonce()
Get the nonce.- Returns:
- The nonce
-
getChunkSize
public int getChunkSize()
Get the chunk size.- Returns:
- Chunk size
-
getHeaderData
public byte[] getHeaderData()
Get the raw header data.- Returns:
- Header data
-
getVersion
public byte getVersion()
Get the Salmon format version- Returns:
- The format version
-
getMagicBytes
public byte[] getMagicBytes()
Get the magic bytes- Returns:
- Magic bytes
-
readHeaderData
public static Header readHeaderData(RandomAccessStream stream) throws java.io.IOException
Parse the header data from the stream- Parameters:
stream
- The stream.- Returns:
- The header data.
- Throws:
java.io.IOException
- Thrown if there is an IO error.
-
writeHeader
public static Header writeHeader(RandomAccessStream stream, byte[] nonce, int chunkSize) throws java.io.IOException
- Throws:
java.io.IOException
-
setChunkSize
public void setChunkSize(int chunkSize)
Set the header chunk size- Parameters:
chunkSize
- The chunk size
-
setVersion
public void setVersion(byte version)
Set the Salmon format version- Parameters:
version
- The format version
-
setNonce
public void setNonce(byte[] nonce)
Set the nonce to be used.- Parameters:
nonce
- The nonce
-
-