| 1 | package File::KeePass::KDBX::Tie::Header; | ||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Database headers | ||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use File::KDBX::Constants qw(:magic :version :cipher :random_stream); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use File::KDBX::Util qw(snakify); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use File::KeePass::KDBX; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Time::Piece; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use parent 'File::KeePass::KDBX::Tie::Hash'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 3 | our $VERSION = '0.901'; # VERSION | |||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | 3 | my @META_FIELDS = qw( | |||||||||||||||||||||||||||||||
| 18 | Generator | ||||||||||||||||||||||||||||||||
| 19 | HeaderHash | ||||||||||||||||||||||||||||||||
| 20 | DatabaseName | ||||||||||||||||||||||||||||||||
| 21 | DatabaseNameChanged | ||||||||||||||||||||||||||||||||
| 22 | DatabaseDescription | ||||||||||||||||||||||||||||||||
| 23 | DatabaseDescriptionChanged | ||||||||||||||||||||||||||||||||
| 24 | DefaultUserName | ||||||||||||||||||||||||||||||||
| 25 | DefaultUserNameChanged | ||||||||||||||||||||||||||||||||
| 26 | MaintenanceHistoryDays | ||||||||||||||||||||||||||||||||
| 27 | Color | ||||||||||||||||||||||||||||||||
| 28 | MasterKeyChanged | ||||||||||||||||||||||||||||||||
| 29 | MasterKeyChangeRec | ||||||||||||||||||||||||||||||||
| 30 | MasterKeyChangeForce | ||||||||||||||||||||||||||||||||
| 31 | RecycleBinUUID | ||||||||||||||||||||||||||||||||
| 32 | RecycleBinChanged | ||||||||||||||||||||||||||||||||
| 33 | EntryTemplatesGroup | ||||||||||||||||||||||||||||||||
| 34 | EntryTemplatesGroupChanged | ||||||||||||||||||||||||||||||||
| 35 | LastSelectedGroup | ||||||||||||||||||||||||||||||||
| 36 | LastTopVisibleGroup | ||||||||||||||||||||||||||||||||
| 37 | HistoryMaxItems | ||||||||||||||||||||||||||||||||
| 38 | HistoryMaxSize | ||||||||||||||||||||||||||||||||
| 39 | SettingsChanged | ||||||||||||||||||||||||||||||||
| 40 | RecycleBinEnabled | ||||||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||||||
| 42 | # MemoryProtection - flattened in KeePass | ||||||||||||||||||||||||||||||||
| 43 | # Binaries - distributed to entries in KeePass | ||||||||||||||||||||||||||||||||
| 44 | # CustomIcons - handled by File::KeePass::KDBX::Tie::CustomIcons | ||||||||||||||||||||||||||||||||
| 45 | # CustomData - handled by File::KeePass::KDBX::Tie::CustomData | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | my %GET = ( | ||||||||||||||||||||||||||||||||
| 48 | 14 | ▶ | sig1 => sub { $_[0]->sig1 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 49 | 14 | ▶ | sig2 => sub { $_[0]->sig2 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | ver => sub { $_[0]->version }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 51 | 27 | ▶ | version => sub { $_[0]->sig2 == KDBX_SIG2_1 ? 1 : 2 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | 15 | ▶ | comment => sub { $_[0]->comment }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 53 | 14 | ▶ | enc_iv => sub { $_[0]->encryption_iv }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 54 | enc_type => sub { | ||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | my %enc_type = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 56 | CIPHER_UUID_AES128() => 'rijndael', | ||||||||||||||||||||||||||||||||
| 57 | CIPHER_UUID_AES256() => 'rijndael', | ||||||||||||||||||||||||||||||||
| 58 | CIPHER_UUID_CHACHA20() => 'chacha20', | ||||||||||||||||||||||||||||||||
| 59 | CIPHER_UUID_SALSA20() => 'salsa20', | ||||||||||||||||||||||||||||||||
| 60 | CIPHER_UUID_SERPENT() => 'serpent', | ||||||||||||||||||||||||||||||||
| 61 | CIPHER_UUID_TWOFISH() => 'twofish', | ||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $enc_type{$_[0]->cipher_id || ''} || 'rijndael'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$_[0]->cipher_id || ''
MC/DC0%0/1
$_[0]->cipher_id || ''
$_[0]->cipher_id
Truth table0%0/2
A
A= $_[0]->cipher_id
| |||||||||||||||||||||||||||||||||
| 64 | }, | ||||||||||||||||||||||||||||||||
| 65 | flags => sub { | ||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my $cipher_id = $_[0]->cipher_id || ''; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
Condition0%0/2
$_[0]->cipher_id || ''
MC/DC0%0/1
$_[0]->cipher_id || ''
$_[0]->cipher_id
Truth table0%0/2
A
A= $_[0]->cipher_id
| |||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | $cipher_id eq CIPHER_UUID_AES128 || $cipher_id eq CIPHER_UUID_AES256 | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$cipher_id eq "a\253\5\241\224dA\303\215t:V=\370\3355" or $cipher_id eq "1\301\362\346\277qCP\276X\5!j\374Z\377"
MC/DC0%0/2
$cipher_id eq "a\253\5\241\224dA\303\215t:V=\370\3355" or $cipher_id eq "1\301\362\346\277qCP\276X\5!j\374Z\377"
$cipher_id eq "a\253\5\241\224dA\303\215t:V=\370\3355"
$cipher_id eq "1\301\362\346\277qCP\276X\5!j\374Z\377"
Truth table0%0/3
A or B
A= $cipher_id eq "a\253\5\241\224dA\303\215t:V=\370\3355"B= $cipher_id eq "1\301\362\346\277qCP\276X\5!j\374Z\377"
| |||||||||||||||||||||||||||||||||
| 68 | ? 2 | ||||||||||||||||||||||||||||||||
| 69 | : $cipher_id eq CIPHER_UUID_TWOFISH | ||||||||||||||||||||||||||||||||
| 70 | ? 8 | ||||||||||||||||||||||||||||||||
| 71 | : undef; | ||||||||||||||||||||||||||||||||
| 72 | }, | ||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | checksum => sub { undef }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | n_entries => sub { $_[0]->entries->size }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | n_groups => sub { $_[0]->groups->size - ($_[0]->_has_implicit_root ? 1 : 0) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | header_size => sub { undef }, # not available from KDBX | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | raw => sub { undef }, # not available from KDBX | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 78 | 14 | ▶ | rounds => sub { $_[0]->transform_rounds }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 79 | 14 | ▶ | seed_key => sub { $_[0]->transform_seed }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 80 | 14 | ▶ | seed_rand => sub { $_[0]->master_seed }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 81 | cipher => sub { | ||||||||||||||||||||||||||||||||
| 82 | 14 | ▶ | my %cipher = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||
| 83 | CIPHER_UUID_AES128() => 'aes', | ||||||||||||||||||||||||||||||||
| 84 | CIPHER_UUID_AES256() => 'aes', | ||||||||||||||||||||||||||||||||
| 85 | CIPHER_UUID_CHACHA20() => 'chacha20', | ||||||||||||||||||||||||||||||||
| 86 | CIPHER_UUID_SALSA20() => 'salsa20', | ||||||||||||||||||||||||||||||||
| 87 | CIPHER_UUID_SERPENT() => 'serpent', | ||||||||||||||||||||||||||||||||
| 88 | CIPHER_UUID_TWOFISH() => 'twofish', | ||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||
| 90 | 14 | ▶ | $cipher{$_[0]->cipher_id || ''} || 'aes'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$_[0]->cipher_id || ''
MC/DC0%0/1
$_[0]->cipher_id || ''
$_[0]->cipher_id
Truth table50%1/2
A
A= $_[0]->cipher_id
| |||||||||||||||||||||||||||||||||
| 91 | }, | ||||||||||||||||||||||||||||||||
| 92 | 14 | ▶ | compression => sub { $_[0]->compression_flags }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 93 | protected_stream => sub { | ||||||||||||||||||||||||||||||||
| 94 | 14 | ▶ | my %protected_stream = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||
| 95 | STREAM_ID_RC4_VARIANT() => 'rc4variant', | ||||||||||||||||||||||||||||||||
| 96 | STREAM_ID_SALSA20() => 'salsa20', | ||||||||||||||||||||||||||||||||
| 97 | STREAM_ID_CHACHA20() => 'chacha20', | ||||||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||||||
| 99 | 14 | ▶ | $protected_stream{$_[0]->inner_random_stream_id} || 'unknown', | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 100 | }, | ||||||||||||||||||||||||||||||||
| 101 | 14 | ▶ | protected_stream_key => sub { $_[0]->inner_random_stream_key }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 102 | 14 | ▶ | start_bytes => sub { $_[0]->stream_start_bytes }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | 0 => sub { "\r\n\r\n" }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 104 | # META | ||||||||||||||||||||||||||||||||
| 105 | 14 | ▶ | protect_notes => sub { $_[0]->protect_notes ? 1 : 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 106 | 14 | ▶ | protect_password => sub { $_[0]->protect_password ? 1 : 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 107 | 14 | ▶ | protect_title => sub { $_[0]->protect_title ? 1 : 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 108 | 14 | ▶ | protect_url => sub { $_[0]->protect_url ? 1 : 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 109 | 14 | ▶ | protect_username => sub { $_[0]->protect_username ? 1 : 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 110 | 14 | ▶ | recycle_bin_enabled => sub { $_[0]->recycle_bin_enabled ? 1 : 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 111 | 14 | ▶ | custom_data => sub { $_[-1]->_tie({}, 'CustomData', $_[0]) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 112 | 14 | ▶ | custom_icons => sub { $_[-1]->_tie({}, 'CustomIcons', $_[0]) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 113 | 3 | ); | |||||||||||||||||||||||||||||||
| 114 | 3 | for my $meta_key (@META_FIELDS) { | |||||||||||||||||||||||||||||||
| 115 | 69 | my $key = snakify($meta_key); | |||||||||||||||||||||||||||||||
| 116 | 69 | ▶ | next if $GET{$key}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 117 | 66 | ▶ | if ($key =~ /_changed$/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 118 | 84 | ▶ | $GET{$key} = sub { File::KeePass::KDBX::_decode_datetime($_[0]->meta->{$key}) }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||
| 120 | else { | ||||||||||||||||||||||||||||||||
| 121 | 196 | ▶ | $GET{$key} = sub { $_[0]->meta->{$key} }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||
| 125 | my %SET = ( | ||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sig1 => sub { $_[0]->sig1($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sig2 => sub { $_[0]->sig2($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | ver => sub { $_[0]->version($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 129 | 15 | ▶ | version => sub { $_[0]->sig2($_ == 1 ? KDBX_SIG2_1 : $_ == 2 ? KDBX_SIG2_2 : undef) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.7
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 130 | 1 | ▶ | comment => sub { $_[0]->comment($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | enc_iv => sub { $_[0]->encryption_iv($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 132 | enc_type => sub { | ||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | my %enc_type = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 134 | chacha20 => CIPHER_UUID_CHACHA20, | ||||||||||||||||||||||||||||||||
| 135 | rijndael => CIPHER_UUID_AES256, | ||||||||||||||||||||||||||||||||
| 136 | salsa20 => CIPHER_UUID_SALSA20, | ||||||||||||||||||||||||||||||||
| 137 | serpent => CIPHER_UUID_SERPENT, | ||||||||||||||||||||||||||||||||
| 138 | twofish => CIPHER_UUID_TWOFISH, | ||||||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | $_[0]->cipher_id($enc_type{$_} || CIPHER_UUID_AES256); | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$enc_type{$_} || "1\301\362\346\277qCP\276X\cE!j\374Z\377"
MC/DC0%0/1
$enc_type{$_} || "1\301\362\346\277qCP\276X\cE!j\374Z\377"
$enc_type{$_}
Truth table0%0/2
A
A= $enc_type{$_}
| |||||||||||||||||||||||||||||||||
| 141 | }, | ||||||||||||||||||||||||||||||||
| 142 | flags => sub { | ||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | my %cipher = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 144 | 2 => CIPHER_UUID_AES256, | ||||||||||||||||||||||||||||||||
| 145 | 8 => CIPHER_UUID_TWOFISH, | ||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | $_[0]->cipher_id($cipher{$_}) if $cipher{$_}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 148 | }, | ||||||||||||||||||||||||||||||||
| 149 | ▶ | checksum => sub { }, # readonly | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 150 | ▶ | n_entries => sub { }, # readonly | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 151 | ▶ | n_groups => sub { }, # readonly | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 152 | ▶ | header_size => sub { }, # not available | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 153 | ▶ | raw => sub { }, # not available | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | rounds => sub { $_[0]->transform_rounds($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | seed_key => sub { $_[0]->transform_seed($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | seed_rand => sub { $_[0]->master_seed($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 157 | cipher => sub { | ||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | my %cipher = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 159 | aes => CIPHER_UUID_AES256, | ||||||||||||||||||||||||||||||||
| 160 | chacha20 => CIPHER_UUID_CHACHA20, | ||||||||||||||||||||||||||||||||
| 161 | salsa20 => CIPHER_UUID_SALSA20, | ||||||||||||||||||||||||||||||||
| 162 | serpent => CIPHER_UUID_SERPENT, | ||||||||||||||||||||||||||||||||
| 163 | twofish => CIPHER_UUID_TWOFISH, | ||||||||||||||||||||||||||||||||
| 164 | ); | ||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $_[0]->cipher_id($cipher{$_} || CIPHER_UUID_AES256); | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$cipher{$_} || "1\301\362\346\277qCP\276X\cE!j\374Z\377"
MC/DC0%0/1
$cipher{$_} || "1\301\362\346\277qCP\276X\cE!j\374Z\377"
$cipher{$_}
Truth table0%0/2
A
A= $cipher{$_}
| |||||||||||||||||||||||||||||||||
| 166 | }, | ||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | compression => sub { $_[0]->compression_flags($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 168 | protected_stream => sub { | ||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my %protected_stream = ( | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 170 | rc4variant => STREAM_ID_RC4_VARIANT, | ||||||||||||||||||||||||||||||||
| 171 | salsa20 => STREAM_ID_SALSA20, | ||||||||||||||||||||||||||||||||
| 172 | chacha20 => STREAM_ID_CHACHA20, | ||||||||||||||||||||||||||||||||
| 173 | ); | ||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my $default_id = $_[0]->version < KDBX_VERSION_4_0 ? STREAM_ID_SALSA20 : STREAM_ID_CHACHA20; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | my $id = $protected_stream{$_} || $default_id; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$protected_stream{$_} || $default_id
MC/DC0%0/2
$protected_stream{$_} || $default_id
$protected_stream{$_}
$default_id
Truth table0%0/3
A || B
A= $protected_stream{$_}B= $default_id
| |||||||||||||||||||||||||||||||||
| 176 | 0 | $_[0]->inner_random_stream_id($id); | |||||||||||||||||||||||||||||||
| 177 | }, | ||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | protected_stream_key => sub { $_[0]->inner_random_stream_key($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | start_bytes => sub { $_[0]->stream_start_bytes($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 180 | ▶ | 0 => sub { }, # readonly | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 181 | # META | ||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | protect_notes => sub { $_[0]->protect_notes($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | protect_password => sub { $_[0]->protect_password($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | protect_title => sub { $_[0]->protect_title($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | protect_url => sub { $_[0]->protect_url($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | protect_username => sub { $_[0]->protect_username($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | recycle_bin_enabled => sub { $_[0]->recycle_bin_enabled($_) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 188 | ▶ | custom_data => sub { }, # TODO - Replace all custom data | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 189 | ▶ | custom_icons => sub { }, # TODO - Replace all icons | |||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 190 | 3 | ); | |||||||||||||||||||||||||||||||
| 191 | 3 | for my $meta_key (@META_FIELDS) { | |||||||||||||||||||||||||||||||
| 192 | 69 | my $key = snakify($meta_key); | |||||||||||||||||||||||||||||||
| 193 | 69 | ▶ | next if $SET{$key}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 194 | 66 | ▶ | if ($key =~ /_changed$/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | $SET{$key} = sub { $_[0]->meta->{$key} = File::KeePass::KDBX::_encode_datetime($_) }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||
| 197 | else { | ||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $SET{$key} = sub { $_[0]->meta->{$key} = $_ }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||
| 202 | 630 | ▶ | sub getters { \%GET } | ||||||||||||||||||||||||||||||
|
Subroutine
getters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 203 | 17 | ▶ | sub setters { \%SET } | ||||||||||||||||||||||||||||||
|
Subroutine
setters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | 3 | 1; | |||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | __END__ | ||||||||||||||||||||||||||||||||