public class KdbxSerializer extends Object
The header fields are encoded using a TLV style. The Type is an enumeration encoded in 1 byte. The length is encoded in 2 bytes and the value according to the length denoted. The sequence is terminated by a zero type with 0 length.
KdbxHeader details the fields of the header.
HashedBlockInputStream for details of this.The methods in this class provide support for serializing and deserializing plain text payload content to and from the above encrypted format.
Various fields of the plain text XML (e.g. passwords) are additionally and optionally encrypted using a second encryption. They are stream encrypted, meaning they have to be decrypted in the same order as they were encrypted, namely actual XML document order. Or at least that is the way it seems. The methods of this class do not perform this aspect of encryption/decryption.
| Modifier and Type | Method and Description |
|---|---|
static OutputStream |
createEncryptedOutputStream(Credentials credentials,
KdbxHeader kdbxHeader,
OutputStream outputStream)
Provides an
OutputStream to be encoded and encrypted in KDBX format |
static InputStream |
createUnencryptedInputStream(Credentials credentials,
KdbxHeader kdbxHeader,
InputStream inputStream)
Provides the payload of a KDBX file as an unencrypted
InputStream. |
static KdbxHeader |
readKdbxHeader(KdbxHeader kdbxHeader,
InputStream inputStream)
Populate a KdbxHeader from the input stream supplied
|
static void |
writeKdbxHeader(KdbxHeader kdbxHeader,
OutputStream outputStream)
Write a KdbxHeader to the output stream supplied.
|
public static InputStream createUnencryptedInputStream(Credentials credentials, KdbxHeader kdbxHeader, InputStream inputStream) throws IOException
InputStream.credentials - credentials for decryption of the streamkdbxHeader - a header instance to be populated with values from the streaminputStream - a KDBX formatted input streamIOException - on errorpublic static OutputStream createEncryptedOutputStream(Credentials credentials, KdbxHeader kdbxHeader, OutputStream outputStream) throws IOException
OutputStream to be encoded and encrypted in KDBX formatcredentials - credentials for encryption of the streamkdbxHeader - a KDBX header to control the formatting and encryption operationoutputStream - output stream to contain the KDBX formatted outputIOException - on errorpublic static KdbxHeader readKdbxHeader(KdbxHeader kdbxHeader, InputStream inputStream) throws IOException
kdbxHeader - a header to be populatedinputStream - an input streamIOException - on errorpublic static void writeKdbxHeader(KdbxHeader kdbxHeader, OutputStream outputStream) throws IOException
kdbxHeader - the header to write and updateoutputStream - the output streamIOException - on errorCopyright © 2016. All rights reserved.