File::KDBX::Key::File - A file key
version 0.906
use File::KDBX::Constants qw(:key_file); use File::KDBX::Key::File; ### Create a key file: my $key = File::KDBX::Key::File->new( filepath => 'path/to/file.keyx', type => KEY_FILE_TYPE_XML, # optional version => 2, # optional raw_key => $raw_key, # optional - leave undefined to generate a random key ); $key->save; ### Use a key file: my $key2 = File::KDBX::Key::File->new('path/to/file.keyx'); # OR my $key2 = File::KDBX::Key::File->new(\$secret); # OR my $key2 = File::KDBX::Key::File->new($fh); # or *IO
A file key (or "key file") is the type of key where the secret is a file. The secret is either the file contents or is generated based on the file contents. In order to lock and unlock a KDBX database with a key file, the same file must be presented. The database cannot be opened without the file.
Inherets methods and attributes from File::KDBX::Key.
There are multiple types of key files supported. See "type". This module can read and write key files.
$type = $key->type;
Get the type of key file. Can be one of from ":key_file" in File::KDBX::Constants:
KEY_FILE_TYPE_BINARY
KEY_FILE_TYPE_HEX
KEY_FILE_TYPE_XML
KEY_FILE_TYPE_HASHED
$version = $key->version;
Get the file version. Only applies to XML key files.
$filepath = $key->filepath;
Get the filepath to the key file, if known.
$key = $key->load($filepath); $key = $key->load(\$string); $key = $key->load($fh); $key = $key->load(*IO);
Load a key file.
$key->reload;
Re-read the key file, if possible, and update the raw key if the key changed.
$key->save; $key->save(%options);
Write a key file. Available options:
type - Type of key file (default: value of "type", or KEY_FILE_TYPE_XML)
type
verson - Version of key file (default: value of "version", or 2)
verson
filepath - Where to save the file (default: value of "filepath")
filepath
fh - IO handle to write to (overrides filepath, one of which must be defined)
fh
raw_key - Raw key (default: value of "raw_key")
raw_key
atomic - Write to the filepath atomically (default: true)
atomic
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.
Charles McGarvey <ccm@cpan.org>
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.
To install File::KDBX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::KDBX
CPAN shell
perl -MCPAN -e shell install File::KDBX
For more information on module installation, please visit the detailed CPAN module installation guide.