Load a key from an InputStream, in this method the inputStream represents the KeyFile
A key file is a file that contains a key (and possibly additional data, e.g. a hash that allows to verify the
integrity of the key). The file extension typically is 'keyx' or 'key'.
The following comes from KeePass Help Files:
Formats. KeePass supports the following key file formats:
- XML (recommended, default). There is an XML format for key files. KeePass 2.x uses this format by
default, i.e. when creating a key file in the master key dialog, an XML key file is created. The syntax
and the semantics of the XML format allow to detect certain corruptions (especially such caused by faulty
hardware or transfer problems), and a hash (in XML key files version 2.0 or higher) allows to verify the
integrity of the key. This format is resistant to most encoding and new-line character changes (which is
useful for instance when the user is opening and saving the key file or when transferring it from/to a
server). Such a key file can be printed (as a backup on paper), and comments can be added in the file
(with the usual XML syntax: ). It is the most flexible format; new features can be added
easily in the future.
- 32 bytes. If the key file contains exactly 32 bytes, these are used as a 256-bit cryptographic key.
This format requires the least disk space.
- Hexadecimal. If the key file contains exactly 64 hexadecimal characters (0-9 and A-F,
in UTF-8/ASCII encoding, one line, no spaces), these are decoded to a 256-bit cryptographic key.
- Hashed. If a key file does not match any of the formats above, its content is hashed using a
cryptographic hash function in order to build a key (typically a 256-bit key with SHA-256).
This allows to use arbitrary files as key files.