Scroll to navigation

File::KDBX::Loader(3pm) User Contributed Perl Documentation File::KDBX::Loader(3pm)

NAME

File::KDBX::Loader - Load KDBX files

VERSION

version 0.906

DESCRIPTION

ATTRIBUTES

kdbx

    $kdbx = $loader->kdbx;
    $loader->kdbx($kdbx);

Get or set the File::KDBX instance for storing the loaded data into.

format

Get the file format used for reading the database. Normally the format is auto-detected from the data stream. This auto-detection works well, so there's not really a good reason to explicitly specify the format. Possible formats:

  • "V3"
  • "V4"
  • "KDB"
  • "XML"
  • "Raw"

inner_format

Get the format of the data inside the KDBX envelope. This only applies to "V3" and "V4" formats. Possible formats:

  • "XML" - Read the database groups and entries as XML (default)
  • "Raw" - Read and store the result in "raw" in File::KDBX without parsing

METHODS

new

    $loader = File::KDBX::Loader->new(%attributes);

Construct a new File::KDBX::Loader.

init

    $loader = $loader->init(%attributes);

Initialize a File::KDBX::Loader with a new set of attributes.

This is called by "new".

reset

    $loader = $loader->reset;

Set a File::KDBX::Loader to a blank state, ready to load another KDBX file.

load

    $kdbx = File::KDBX::Loader->load(\$string, %options);
    $kdbx = File::KDBX::Loader->load(\$string, $key);
    $kdbx = File::KDBX::Loader->load(*IO, %options);
    $kdbx = File::KDBX::Loader->load(*IO, $key);
    $kdbx = File::KDBX::Loader->load($filepath, %options);
    $kdbx = File::KDBX::Loader->load($filepath, $key);

Load a KDBX file. This works as an instance or a class method. The $key is either a File::KDBX::Key or a primitive castable to a Key object. Available options:

"key" - Alternative way to specify $key

load_string

    $kdbx = File::KDBX::Loader->load_string($string, %options);
    $kdbx = File::KDBX::Loader->load_string($string, $key);
    $kdbx = File::KDBX::Loader->load_string(\$string, %options);
    $kdbx = File::KDBX::Loader->load_string(\$string, $key);

Load a KDBX file from a string / memory buffer. This works as an instance or class method. Available options:

"key" - Alternative way to specify $key

load_file

    $kdbx = File::KDBX::Loader->load_file($filepath, %options);
    $kdbx = File::KDBX::Loader->load_file($filepath, $key);

Read a KDBX file from a filesystem. This works as an instance or class method. Available options:

"key" - Alternative way to specify $key

load_handle

    $kdbx = File::KDBX::Loader->load_handle($fh, %options);
    $kdbx = File::KDBX::Loader->load_handle($fh, $key);
    $kdbx = File::KDBX::Loader->load_handle(*IO, %options);
    $kdbx = File::KDBX::Loader->load_handle(*IO, $key);

Read a KDBX file from an input stream / file handle. This works as an instance or class method. Available options:

"key" - Alternative way to specify $key

read_magic_numbers

    $magic = File::KDBX::Loader->read_magic_numbers($fh);
    ($sig1, $sig2, $version, $magic) = File::KDBX::Loader->read_magic_numbers($fh);
    $magic = $loader->read_magic_numbers($fh);
    ($sig1, $sig2, $version, $magic) = $loader->read_magic_numbers($fh);

Read exactly 12 bytes from an IO handle and parse them into the three magic numbers that begin a KDBX file. This is a quick way to determine if a file is actually a KDBX file.

$sig1 should always be "KDBX_SIG1" if reading an actual KDB or KDBX file.

$sig2 should be "KDBX_SIG2_1" for KeePass 1 files and "KDBX_SIG2_2" for KeePass 2 files.

$version is the file version (e.g. 0x00040001).

$magic is the raw 12 bytes read from the IO handle.

If called on an instance, the "sig1", "sig2" and "version" attributes will be set in the "kdbx" and the instance will be blessed into the correct loader subclass.

BUGS

Please report any bugs or feature requests on the bugtracker website <https://github.com/chazmcgarvey/File-KDBX/issues>

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Charles McGarvey <ccm@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Charles McGarvey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2022-11-20 perl v5.36.0