KeePassHeader { public CompressionAlgorithm getCompression() { return compressionAlgorithm; } KeePassHeader();  KeePassHeader(ByteGenerator byteGenerator); void setValue(int headerId, byte[] value); void checkVersionSupport(byte[] keepassFile); @SuppressWarnings("resource") void read(byte[] keepassFile); byte[] getBytes(); byte[] getValue(int headerId); void setCompression(CompressionAlgorithm algorithm); byte[] getCipher(); CompressionAlgorithm getCompression(); long getTransformRounds(); void setTransformRounds(long rounds); byte[] getEncryptionIV(); byte[] getStreamStartBytes(); CrsAlgorithm getCrsAlgorithm(); void setCrsAlgorithm(CrsAlgorithm algorithm); byte[] getMasterSeed(); byte[] getTransformSeed(); VariantDictionary getKdfParameters(); int getHeaderSize(); byte[] getProtectedStreamKey(); int getFileFormatVersion(); static final int CIPHER; static final int COMPRESSION; static final int MASTER_SEED; static final int TRANSFORM_SEED; static final int TRANSFORM_ROUNDS; static final int ENCRYPTION_IV; static final int PROTECTED_STREAM_KEY; static final int STREAM_START_BYTES; static final int INNER_RANDOM_STREAM_ID; static final int KDF_PARAMETERS; static final int PUBLIC_CUSTOM_DATA; static final int VERSION_SIGNATURE_LENGTH; }
@Test public void whenCompressionIsSetGzipShouldReturnHeaderWithGzipCompression() { ByteBuffer b = ByteBuffer.allocate(4); b.putInt(0x01000000); KeePassHeader header = createHeaderAndSetValue(3, b.array()); Assert.assertEquals(CompressionAlgorithm.Gzip, header.getCompression()); }
@Test public void whenCompressionIsSetNoneShouldReturnHeaderWithNoneCompression() { KeePassHeader header = createHeaderAndSetValue(3, new byte[4]); Assert.assertEquals(CompressionAlgorithm.None, header.getCompression()); }