public class HmacBlockOutputStream extends FilterOutputStream
An HMac block consists of
The Class is initialized with an initial key digest. For each block this key is transformed using the (implied, starting from 0) block number and used as the key for the block verification process. That process consists of digesting the block number, its length, and its content.
Streams in Keepass are Little Endian.
out| Constructor and Description |
|---|
HmacBlockOutputStream(byte[] key,
OutputStream outputStream)
Create a BigEndian HmacBlockOutputStream
|
HmacBlockOutputStream(byte[] key,
OutputStream outputStream,
boolean littleEndian)
Create a HmacBlockOutputStream with choice of endian encoding
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
protected void |
put(byte[] b,
int offset,
int length)
Writes to the internal buffer, and writes to the underlying output stream
as necessary as
BLOCK_SIZE blocks |
protected void |
save()
Save the internal buffer to the underlying stream as a Hmac block
|
void |
write(byte[] b,
int offset,
int count) |
void |
write(int i) |
writepublic HmacBlockOutputStream(byte[] key,
OutputStream outputStream)
throws IOException
key - credentials for this databaseoutputStream - the output stream to receive the hash blocksIOExceptionpublic HmacBlockOutputStream(byte[] key,
OutputStream outputStream,
boolean littleEndian)
throws IOException
key - credentials for this databaseoutputStream - the output stream to receive the hash blockslittleEndian - true to encode in a little endian wayIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOExceptionprotected void put(byte[] b,
int offset,
int length)
throws IOException
BLOCK_SIZE blocksb - the byte array to writeoffset - offset in the byte arraylength - number of bytes to writeIOExceptionprotected void save()
throws IOException
IOExceptionpublic void write(int i)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void write(byte[] b,
int offset,
int count)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class FilterOutputStreamIOExceptionCopyright © 2023. All rights reserved.