| File::KDBX::Key::File(3pm) | User Contributed Perl Documentation | File::KDBX::Key::File(3pm) |
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:
$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:
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.
| 2022-11-20 | perl v5.36.0 |